* acinclude.m4: Use AS_HELP_STRING, not AC_HELP_STRING.
[deliverable/binutils-gdb.git] / gdb / configure.ac
1 dnl Autoconf configure script for GDB, the GNU debugger.
2 dnl Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
3 dnl 2005, 2006, 2007, 2008, 2009
4 dnl Free Software Foundation, Inc.
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
10 dnl the Free Software Foundation; either version 3 of the License, or
11 dnl (at your option) any later version.
12 dnl
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.
17 dnl
18 dnl You should have received a copy of the GNU General Public License
19 dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
20
21 dnl Process this file with autoconf to produce a configure script.
22
23 AC_PREREQ(2.59)dnl
24 AC_INIT(main.c)
25 AC_CONFIG_HEADER(config.h:config.in)
26 AM_MAINTAINER_MODE
27
28 AC_PROG_CC
29 AC_GNU_SOURCE
30 AC_AIX
31 AC_ISC_POSIX
32 gl_EARLY
33 AM_PROG_CC_STDC
34
35 AC_CONFIG_AUX_DIR(..)
36 AC_CANONICAL_SYSTEM
37
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
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
65 dnl Set up for gettext.
66 ZW_GNU_GETTEXT_SISTER_DIR
67
68 localedir='${datadir}/locale'
69 AC_SUBST(localedir)
70
71 if test x"$USE_NLS" = xyes; then
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
78 gl_INIT
79
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
87 PACKAGE=gdb
88 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package. ])
89 AC_SUBST(PACKAGE)
90
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
95 debugdir=${libdir}/debug
96
97 AC_ARG_WITH(separate-debug-dir,
98 [AS_HELP_STRING([--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"),
104
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
121 AC_ARG_WITH(relocated-sources,
122 AS_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
128 AC_CONFIG_SUBDIRS(doc testsuite)
129
130 # Check whether to support alternative target configurations
131 AC_ARG_ENABLE(targets,
132 AS_HELP_STRING([--enable-targets=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
140 # Check whether to enable 64-bit support on 32-bit hosts
141 AC_ARG_ENABLE(64-bit-bfd,
142 AS_HELP_STRING([--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
149 # Provide defaults for some variables set by the per-host and per-target
150 # configuration.
151 gdb_host_obs=posix-hdep.o
152
153 if test "${target}" = "${host}"; then
154 gdb_native=yes
155 else
156 gdb_native=no
157 fi
158
159 . $srcdir/configure.host
160
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
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
195 fi
196 done
197
198 if test x${all_targets} = xtrue; then
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
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
229
230 # Fetch the default architecture and default target vector from BFD.
231 targ=$target; . $srcdir/../bfd/config.bfd
232
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/ .*//'`
236
237 if test "x$targ_archs" != x; then
238 AC_DEFINE_UNQUOTED(DEFAULT_BFD_ARCH, $targ_archs,
239 [Define to BFD's default architecture. ])
240 fi
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. ])
244 fi
245
246 # The CLI cannot be disabled yet, but may be in the future.
247
248 # Enable CLI.
249 AC_ARG_ENABLE(gdbcli,
250 AS_HELP_STRING([--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)"
265 ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_CLI_CFLAGS)"
266 fi
267 fi
268
269 # Enable MI.
270 AC_ARG_ENABLE(gdbmi,
271 AS_HELP_STRING([--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)"
284 ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_MI_CFLAGS)"
285 fi
286 fi
287
288 # Enable TUI.
289 AC_ARG_ENABLE(tui,
290 AS_HELP_STRING([--enable-tui], [enable full-screen terminal user interface (TUI)]),
291 [case $enableval in
292 yes | no | auto)
293 ;;
294 *)
295 AC_MSG_ERROR([bad value $enableval for --enable-tui]) ;;
296 esac],enable_tui=auto)
297
298 # Enable gdbtk.
299 AC_ARG_ENABLE(gdbtk,
300 AS_HELP_STRING([--enable-gdbtk], [enable gdbtk graphical user interface (GUI)]),
301 [case $enableval in
302 yes | no)
303 ;;
304 *)
305 AC_MSG_ERROR([bad value $enableval for --enable-gdbtk]) ;;
306 esac],
307 [if test -d $srcdir/gdbtk; then
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
319 # Libunwind support.
320 AC_ARG_WITH(libunwind,
321 AS_HELP_STRING([--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],[
327 AC_CHECK_HEADERS(libunwind.h libunwind-ia64.h)
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
334 AC_CHECK_HEADERS(libunwind.h libunwind-ia64.h)
335 AC_DEFINE(HAVE_LIBUNWIND, 1, [Define if libunwind library is being used.])
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
341 opt_curses=no
342 AC_ARG_WITH(curses, AS_HELP_STRING([--with-curses], [use the curses library instead of the termcap library]), opt_curses=$withval)
343
344 prefer_curses=no
345 if test "$opt_curses" = "yes"; then
346 prefer_curses=yes
347 fi
348
349 # Profiling support.
350 AC_ARG_ENABLE(profiling,
351 AS_HELP_STRING([--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
360 AC_CHECK_FUNCS(monstartup _mcleanup)
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
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
381 if test "$enable_profiling" = yes ; then
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
385 PROFILE_CFLAGS=-pg
386 OLD_CFLAGS="$CFLAGS"
387 CFLAGS="$CFLAGS $PROFILE_CFLAGS"
388
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)])
392
393 if test $ac_cv_cc_supports_pg = no; then
394 AC_MSG_ERROR(--enable-profiling requires a compiler which supports -pg)
395 fi
396
397 CFLAGS="$OLD_CFLAGS"
398 fi
399
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
405 # --------------------- #
406 # Checks for programs. #
407 # --------------------- #
408
409 AC_PROG_AWK
410 AC_PROG_INSTALL
411 AC_PROG_LN_S
412 AC_PROG_RANLIB
413 AC_PROG_YACC
414
415 AC_CHECK_TOOL(AR, ar)
416 AC_CHECK_TOOL(DLLTOOL, dlltool)
417 AC_CHECK_TOOL(WINDRES, windres)
418
419 # Needed for GNU/Hurd.
420 AC_CHECK_TOOL(MIG, mig)
421
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
436 # Some systems (e.g. Solaris) have `gethostbyname' in libnsl.
437 AC_SEARCH_LIBS(gethostbyname, nsl)
438
439 # Some systems (e.g. Solaris) have `socketpair' in libsocket.
440 AC_SEARCH_LIBS(socketpair, socket)
441
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
445 # On HP/UX we may need libxpdl for dlgetmodinfo (used by solib-pa64.c).
446 AC_SEARCH_LIBS(dlgetmodinfo, [dl xpdl])
447
448 AM_ICONV
449
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
477 # For the TUI, we need enhanced curses functionality.
478 if test x"$enable_tui" != xno; then
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
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
502 if test "$curses_found" != no; then
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
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.
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 ;;
531 go32* | *djgpp*)
532 ac_cv_search_tgetent="none required"
533 ;;
534 *mingw32*)
535 ac_cv_search_tgetent="none required"
536 CONFIG_OBS="$CONFIG_OBS windows-termcap.o"
537 ;;
538 esac
539
540 # These are the libraries checked by Readline.
541 AC_SEARCH_LIBS(tgetent, [termcap tinfo curses ncurses])
542
543 if test "$ac_cv_search_tgetent" = no; then
544 AC_MSG_ERROR([no termcap library found])
545 fi
546
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
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
573 else
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
588 fi
589
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
702 # Even if Python support is not compiled in, we need to have these files
703 # included in order to recognize the GDB command "python".
704 CONFIG_OBS="$CONFIG_OBS python.o python-value.o"
705 CONFIG_SRCS="$CONFIG_SRCS python/python.c python/python-value.c"
706 fi
707 AC_SUBST(PYTHON_CFLAGS)
708
709 # ------------------------- #
710 # Checks for header files. #
711 # ------------------------- #
712
713 AC_HEADER_DIRENT
714 AC_HEADER_STAT
715 AC_HEADER_STDC
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 \
726 sgtty.h unistd.h elf_hp.h ctype.h time.h locale.h])
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 ])
735 AC_CHECK_HEADERS(sys/proc.h, [], [],
736 [#if HAVE_SYS_PARAM_H
737 # include <sys/param.h>
738 #endif
739 ])
740 AC_CHECK_HEADERS(sys/user.h, [], [],
741 [#if HAVE_SYS_PARAM_H
742 # include <sys/param.h>
743 #endif
744 ])
745
746 # On Solaris 2.[789], we need to define _MSE_INT_H to avoid a clash
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
750 solaris2.[[789]])
751 if test "$GCC" = yes; then
752 AC_DEFINE(_MSE_INT_H, 1,
753 [Define to 1 to avoid a clash between <widec.h> and <wchar.h> on
754 Solaris 2.[789] when using GCC. ])
755 fi ;;
756 esac
757 AC_CHECK_HEADERS(curses.h cursesX.h ncurses.h ncurses/ncurses.h ncurses/term.h)
758 AC_CHECK_HEADERS(term.h, [], [],
759 [#if HAVE_CURSES_H
760 # include <curses.h>
761 #endif
762 ])
763
764 # ------------------------- #
765 # Checks for declarations. #
766 # ------------------------- #
767
768 AC_CHECK_DECLS([free, malloc, realloc, strerror, strstr, getopt,
769 snprintf, vsnprintf])
770 AM_LC_MESSAGES
771
772 # ----------------------- #
773 # Checks for structures. #
774 # ----------------------- #
775
776 AC_CHECK_MEMBERS([struct stat.st_blocks, struct stat.st_blksize])
777
778 # ------------------ #
779 # Checks for types. #
780 # ------------------ #
781
782 AC_TYPE_SIGNAL
783 AC_CHECK_TYPES(socklen_t, [], [],
784 [#include <sys/types.h>
785 #include <sys/socket.h>
786 ])
787
788 # ------------------------------------- #
789 # Checks for compiler characteristics. #
790 # ------------------------------------- #
791
792 AC_C_CONST
793 AC_C_INLINE
794 AC_C_BIGENDIAN
795
796 # ------------------------------ #
797 # Checks for library functions. #
798 # ------------------------------ #
799
800 AC_FUNC_ALLOCA
801 AC_FUNC_MMAP
802 AC_FUNC_VFORK
803 AC_CHECK_FUNCS([canonicalize_file_name realpath getrusage getuid \
804 getgid poll pread64 sbrk setpgid setpgrp setsid \
805 sigaction sigprocmask sigsetmask socketpair syscall \
806 ttrace wborder setlocale iconvlist libiconvlist btowc])
807 AM_LANGINFO_CODESET
808
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.
823 AC_CHECK_DECLS(ptrace, [], [
824 : ${gdb_cv_func_ptrace_ret='int'}
825 : ${gdb_cv_func_ptrace_args='int,int,long,long'}
826 ], $gdb_ptrace_headers)
827 # Check return type. Varargs (used on GNU/Linux) conflict with the
828 # empty argument list, so check for that explicitly.
829 AC_CACHE_CHECK([return type of ptrace], gdb_cv_func_ptrace_ret,
830 AC_TRY_COMPILE($gdb_ptrace_headers,
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')))
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, [
841 AC_TRY_COMPILE($gdb_ptrace_headers,
842 [extern long ptrace (enum __ptrace_request, ...);],
843 [gdb_cv_func_ptrace_args='int,int,long,long'],[
844 for gdb_arg1 in 'int' 'long'; do
845 for gdb_arg2 in 'pid_t' 'int' 'long'; do
846 for gdb_arg3 in 'int *' 'caddr_t' 'int' 'long' 'void *'; do
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'}
867 ])])
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
872 AC_DEFINE_UNQUOTED(PTRACE_TYPE_ARG3, $[3],
873 [Define to the type of arg 3 for ptrace.])
874 if test -n "$[5]"; then
875 AC_DEFINE_UNQUOTED(PTRACE_TYPE_ARG5, $[5],
876 [Define to the type of arg 5 for ptrace.])
877 fi
878
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
897
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
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 AS_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)]),
931 gdb_with_regex=$withval,
932 gdb_with_regex=$gdb_use_included_regex)
933 if 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.])
936 fi
937
938 # Check if <sys/proc.h> defines `struct thread' with a td_pcb member.
939 AC_CHECK_MEMBERS([struct thread.td_pcb], [], [],
940 [#include <sys/param.h>
941 #include <sys/proc.h>
942 ])
943
944 # See if <sys/lwp.h> defines `struct lwp`.
945 AC_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;],
948 gdb_cv_struct_lwp=yes, gdb_cv_struct_lwp=no)])
949 if test $gdb_cv_struct_lwp = yes; then
950 AC_DEFINE(HAVE_STRUCT_LWP, 1,
951 [Define to 1 if your system has struct lwp.])
952 fi
953
954 # See if <machine/reg.h> degines `struct reg'.
955 AC_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;],
958 gdb_cv_struct_reg=yes, gdb_cv_struct_reg=no)])
959 if 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>.])
962 fi
963
964 # See if <machine/reg.h> supports the %fs and %gs i386 segment registers.
965 # Older i386 BSD's don't have the r_fs and r_gs members of `struct reg'.
966 AC_CHECK_MEMBERS([struct reg.r_fs, struct reg.r_gs], [], [],
967 [#include <machine/reg.h>])
968
969 # See if <sys/ptrace.h> provides the PTRACE_GETREGS request.
970 AC_MSG_CHECKING(for PTRACE_GETREGS)
971 AC_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])])
976 AC_MSG_RESULT($gdb_cv_have_ptrace_getregs)
977 if test $gdb_cv_have_ptrace_getregs = yes; then
978 AC_DEFINE(HAVE_PTRACE_GETREGS, 1,
979 [Define if sys/ptrace.h defines the PTRACE_GETREGS request.])
980 fi
981
982 # See if <sys/ptrace.h> provides the PTRACE_GETFPXREGS request.
983 AC_MSG_CHECKING(for PTRACE_GETFPXREGS)
984 AC_CACHE_VAL(gdb_cv_have_ptrace_getfpxregs,
985 [AC_TRY_COMPILE([#include <sys/ptrace.h>],
986 [PTRACE_GETFPXREGS;],
987 [gdb_cv_have_ptrace_getfpxregs=yes],
988 [gdb_cv_have_ptrace_getfpxregs=no])])
989 AC_MSG_RESULT($gdb_cv_have_ptrace_getfpxregs)
990 if test $gdb_cv_have_ptrace_getfpxregs = yes; then
991 AC_DEFINE(HAVE_PTRACE_GETFPXREGS, 1,
992 [Define if sys/ptrace.h defines the PTRACE_GETFPXREGS request.])
993 fi
994
995 # See if <sys/ptrace.h> provides the PT_GETDBREGS request.
996 AC_MSG_CHECKING(for PT_GETDBREGS)
997 AC_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])])
1003 AC_MSG_RESULT($gdb_cv_have_pt_getdbregs)
1004 if test $gdb_cv_have_pt_getdbregs = yes; then
1005 AC_DEFINE(HAVE_PT_GETDBREGS, 1,
1006 [Define if sys/ptrace.h defines the PT_GETDBREGS request.])
1007 fi
1008
1009 # See if <sys/ptrace.h> provides the PT_GETXMMREGS request.
1010 AC_MSG_CHECKING(for PT_GETXMMREGS)
1011 AC_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])])
1017 AC_MSG_RESULT($gdb_cv_have_pt_getxmmregs)
1018 if test $gdb_cv_have_pt_getxmmregs = yes; then
1019 AC_DEFINE(HAVE_PT_GETXMMREGS, 1,
1020 [Define if sys/ptrace.h defines the PT_GETXMMREGS request.])
1021 fi
1022
1023 # Detect which type of /proc is in use, such as for Unixware or Solaris.
1024
1025 if test "${target}" = "${host}"; then
1026 case "${host}" in
1027 *-*-unixware* | *-*-sysv4.2* | *-*-sysv5* | *-*-interix* )
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).])
1031 ;;
1032 *-*-solaris2.[[6789]] | *-*-solaris2.1[[0-9]]*)
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).])
1036 ;;
1037 mips-sgi-irix5*)
1038 # Work around <sys/proc.h> needing _KMEMUSER problem on IRIX 5.
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.])
1042 ;;
1043 esac
1044 fi
1045
1046 if 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)
1051 BFD_HAVE_SYS_PROCFS_TYPE(prgregset_t)
1052 BFD_HAVE_SYS_PROCFS_TYPE(prfpregset_t)
1053 BFD_HAVE_SYS_PROCFS_TYPE(prgregset32_t)
1054 BFD_HAVE_SYS_PROCFS_TYPE(prfpregset32_t)
1055 BFD_HAVE_SYS_PROCFS_TYPE(lwpid_t)
1056 BFD_HAVE_SYS_PROCFS_TYPE(psaddr_t)
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)
1061
1062
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
1068 dnl around it in gdb_proc_service.h.
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
1085 AC_DEFINE(PRFPREGSET_T_BROKEN, 1,
1086 [Define if the prfpregset_t type is broken.])
1087 fi
1088 fi
1089
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
1104 AC_DEFINE(HAVE_PROCFS_PIOCSET, 1,
1105 [Define if ioctl argument PIOCSET is available.])
1106 fi
1107 fi
1108
1109 dnl For native ports (host == target), check to see what kind of
1110 dnl legacy link.h support is needed. (See solib-legacy.c.)
1111 if 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
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.)])
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
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.)])
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>
1152 #ifdef HAVE_NLIST_H
1153 #include <nlist.h>
1154 #endif
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
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.)])
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
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)])
1181 fi
1182 fi
1183
1184 # Check if the compiler supports the `long long' type.
1185
1186 AC_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)])
1192 if test $gdb_cv_c_long_long = yes; then
1193 AC_DEFINE(CC_HAS_LONG_LONG, 1,
1194 [Define to 1 if the compiler supports long long.])
1195 fi
1196
1197 # Check if the compiler and runtime support printing long longs.
1198
1199 AC_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];
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);
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)])
1213 if test $gdb_cv_printf_has_long_long = yes; then
1214 AC_DEFINE(PRINTF_HAS_LONG_LONG, 1,
1215 [Define to 1 if the "%ll" format works to print long longs.])
1216 fi
1217
1218 # Check if the compiler and runtime support printing decfloats.
1219
1220 AC_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)])
1232 if 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.])
1235 fi
1236
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.
1241
1242 AC_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)])
1246 if 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.])
1249 fi
1250
1251 # Check if the compiler and runtime support printing long doubles.
1252
1253 AC_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];
1257 long double f = 3.141592653;
1258 sprintf (buf, "%Lg", f);
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)])
1263 if test $gdb_cv_printf_has_long_double = yes; then
1264 AC_DEFINE(PRINTF_HAS_LONG_DOUBLE, 1,
1265 [Define to 1 if the "%Lg" format works to print long doubles.])
1266 fi
1267
1268 # Check if the compiler and runtime support scanning long doubles.
1269
1270 AC_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";
1275 long double f = 0;
1276 sscanf (buf, "%Lg", &f);
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)])
1281 if test $gdb_cv_scanf_has_long_double = yes; then
1282 AC_DEFINE(SCANF_HAS_LONG_DOUBLE, 1,
1283 [Define to 1 if the "%Lg" format works to scan long doubles.])
1284 fi
1285
1286 case ${host_os} in
1287 aix*)
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=])
1298 LDFLAGS="${SAVE_LDFLAGS}"
1299 ])
1300 CONFIG_LDFLAGS="${CONFIG_LDFLAGS} ${gdb_cv_bigtoc}"
1301 ;;
1302 esac
1303
1304
1305 dnl For certain native configurations, we need to check whether thread
1306 dnl support can be built in or not.
1307 dnl
1308 dnl Note that we only want this if we are both native (host == target),
1309 dnl and not doing a canadian cross build (build == host).
1310
1311 if 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)
1318 AC_DEFINE(HAVE_HPUX_THREAD_SUPPORT, 1,
1319 [Define if you have HPUX threads])
1320 CONFIG_OBS="${CONFIG_OBS} hpux-thread.o"
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*)
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.
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)
1337 AC_DEFINE(HAVE_THREAD_DB_LIB, 1,
1338 [Define if using Solaris thread debugging.])
1339 CONFIG_OBS="${CONFIG_OBS} sol-thread.o"
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
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.])
1371 fi
1372 else
1373 AC_MSG_RESULT(no)
1374 fi
1375 ;;
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"
1388 CONFIG_OBS="${CONFIG_OBS} aix-thread.o"
1389 CONFIG_LDFLAGS="${CONFIG_LDFLAGS} -lpthdebug"
1390 fi
1391 ;;
1392 esac
1393 AC_SUBST(CONFIG_LDFLAGS)
1394 fi
1395
1396 dnl See if we have a thread_db header file that has TD_NOTALLOC and
1397 dnl other error codes.
1398 if 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 )
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 )
1426 fi
1427 if 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.])
1430 fi
1431 if 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.])
1434 fi
1435 if 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.])
1438 fi
1439
1440 dnl See if we have a sys/syscall header file that has __NR_tkill.
1441 if 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 )
1451 fi
1452 dnl See if we can issue tkill syscall.
1453 if test "x$gdb_cv_sys_syscall_h_has_tkill" = "xyes" && test "x$ac_cv_func_syscall" = "xyes"; then
1454 AC_DEFINE(HAVE_TKILL_SYSCALL, 1, [Define if you support the tkill syscall.])
1455 fi
1456
1457 dnl Check if we can disable the virtual address space randomization.
1458 dnl The functionality of setarch -R.
1459 AC_CHECK_DECLS([ADDR_NO_RANDOMIZE],,, [#include <sys/personality.h>])
1460 define([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])])
1468 AC_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])])
1474 if $have_personality
1475 then
1476 AC_DEFINE([HAVE_PERSONALITY], 1,
1477 [Define if you support the personality syscall.])
1478 fi
1479
1480 dnl Handle optional features that can be enabled.
1481
1482 AC_ARG_WITH(sysroot,
1483 AS_HELP_STRING([--with-sysroot@<:@=DIR@:>@], [search for usr/lib et al within DIR]),
1484 [
1485 case ${with_sysroot} in
1486 yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_alias}/sys-root' ;;
1487 *) TARGET_SYSTEM_ROOT=$with_sysroot ;;
1488 esac
1489
1490 TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'
1491
1492 if test "x$prefix" = xNONE; then
1493 test_prefix=/usr/local
1494 else
1495 test_prefix=$prefix
1496 fi
1497 if test "x$exec_prefix" = xNONE || test "x$exec_prefix" = 'x${prefix}'; then
1498 test_exec_prefix=$test_prefix
1499 else
1500 test_exec_prefix=$exec_prefix
1501 fi
1502 case ${TARGET_SYSTEM_ROOT} in
1503 "${test_prefix}"|"${test_prefix}/"*|\
1504 "${test_exec_prefix}"|"${test_exec_prefix}/"*|\
1505 '${prefix}'|'${prefix}/'*|\
1506 '${exec_prefix}'|'${exec_prefix}/'*)
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 ])
1515 AC_SUBST(TARGET_SYSTEM_ROOT)
1516 AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
1517
1518 system_gdbinit=
1519 AC_ARG_WITH(system-gdbinit,
1520 AS_HELP_STRING([--with-system-gdbinit=FILE], [automatically load a system-wide gdbinit file]),
1521 [system_gdbinit=${withval}])
1522
1523 AC_DEFINE_DIR(SYSTEM_GDBINIT, system_gdbinit,
1524 [System-wide gdbinit file.])
1525
1526 if test "x$prefix" = xNONE; then
1527 test_prefix=$ac_default_prefix
1528 else
1529 test_prefix=$prefix
1530 fi
1531 if test "x$exec_prefix" = xNONE || test "x$exec_prefix" = 'x${prefix}'; then
1532 test_exec_prefix=$test_prefix
1533 else
1534 test_exec_prefix=$exec_prefix
1535 fi
1536 case ${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 ;;
1544 esac
1545
1546 AC_ARG_ENABLE(werror,
1547 AS_HELP_STRING([--enable-werror], [treat compile warnings as errors]),
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
1555 if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
1556 ERROR_ON_WARNING=yes
1557 fi
1558
1559 WERROR_CFLAGS=""
1560 if test "${ERROR_ON_WARNING}" = yes ; then
1561 WERROR_CFLAGS="-Werror"
1562 fi
1563
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
1568 # gdb/doc/gdbint.texinfo.
1569 build_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \
1570 -Wformat-nonliteral -Wno-pointer-sign \
1571 -Wno-unused -Wno-switch -Wno-char-subscripts"
1572
1573 # Enable -Wno-format by default when using gcc on mingw since many
1574 # GCC versions complain about %I64.
1575 case "${host}" in
1576 *-*-mingw32*) build_warnings="$build_warnings -Wno-format" ;;
1577 esac
1578
1579 AC_ARG_ENABLE(build-warnings,
1580 AS_HELP_STRING([--enable-build-warnings], [enable build-time compiler warnings if gcc is used]),
1581 [case "${enableval}" in
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"`;;
1589 esac
1590 if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
1591 echo "Setting compiler warning flags = $build_warnings" 6>&1
1592 fi])dnl
1593 AC_ARG_ENABLE(gdb-build-warnings,
1594 AS_HELP_STRING([--enable-gdb-build-warnings], [enable GDB specific build-time compiler warnings if gcc is used]),
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"`;;
1603 esac
1604 if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
1605 echo "Setting GDB specific compiler warning flags = $build_warnings" 6>&1
1606 fi])dnl
1607 WARN_CFLAGS=""
1608 if test "x${build_warnings}" != x -a "x$GCC" = xyes
1609 then
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
1617 saved_CFLAGS="$CFLAGS"
1618 CFLAGS="$CFLAGS $w"
1619 AC_TRY_COMPILE([],[],WARN_CFLAGS="${WARN_CFLAGS} $w",)
1620 CFLAGS="$saved_CFLAGS"
1621 esac
1622 done
1623 AC_MSG_RESULT(${WARN_CFLAGS} ${WERROR_CFLAGS})
1624 fi
1625 AC_SUBST(WARN_CFLAGS)
1626 AC_SUBST(WERROR_CFLAGS)
1627
1628 # In the Cygwin environment, we need some additional flags.
1629 AC_CACHE_CHECK([for cygwin], gdb_cv_os_cygwin,
1630 [AC_EGREP_CPP(lose, [
1631 #if defined (__CYGWIN__) || defined (__CYGWIN32__)
1632 lose
1633 #endif],[gdb_cv_os_cygwin=yes],[gdb_cv_os_cygwin=no])])
1634
1635
1636 dnl Figure out which of the many generic ser-*.c files the _host_ supports.
1637 SER_HARDWIRE="ser-base.o ser-unix.o ser-pipe.o ser-tcp.o"
1638 case ${host} in
1639 *go32* ) SER_HARDWIRE=ser-go32.o ;;
1640 *djgpp* ) SER_HARDWIRE=ser-go32.o ;;
1641 *mingw32*) SER_HARDWIRE="ser-base.o ser-tcp.o ser-mingw.o" ;;
1642 esac
1643 AC_SUBST(SER_HARDWIRE)
1644
1645 # libreadline needs libuser32.a in a cygwin environment
1646 WIN32LIBS=
1647 if test x$gdb_cv_os_cygwin = xyes; then
1648 WIN32LIBS="-luser32"
1649 case "${target}" in
1650 *cygwin*) WIN32LIBS="$WIN32LIBS -limagehlp"
1651 ;;
1652 esac
1653 fi
1654
1655 # The ser-tcp.c module requires sockets.
1656 case ${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 ;;
1665 esac
1666 AC_SUBST(WIN32LIBS)
1667
1668 # Add ELF support to GDB, but only if BFD includes ELF support.
1669 OLD_CFLAGS=$CFLAGS
1670 OLD_LDFLAGS=$LDFLAGS
1671 OLD_LIBS=$LIBS
1672 CFLAGS="$CFLAGS -I${srcdir}/../include -I../bfd -I${srcdir}/../bfd"
1673 LDFLAGS="$LDFLAGS -L../bfd -L../libiberty"
1674 intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'`
1675 LIBS="-lbfd -liberty $intl $LIBS"
1676 AC_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); ],
1683 gdb_cv_var_elf=yes, gdb_cv_var_elf=no)])
1684 if 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.])
1688 fi
1689 CFLAGS=$OLD_CFLAGS
1690 LDFLAGS=$OLD_LDFLAGS
1691 LIBS=$OLD_LIBS
1692
1693 # Add any host-specific objects to GDB.
1694 CONFIG_OBS="${CONFIG_OBS} ${gdb_host_obs}"
1695
1696 LIBGUI="../libgui/src/libgui.a"
1697 GUI_CFLAGS_X="-I${srcdir}/../libgui/src"
1698 AC_SUBST(LIBGUI)
1699 AC_SUBST(GUI_CFLAGS_X)
1700
1701 WIN32LDAPP=
1702 AC_SUBST(WIN32LIBS)
1703 AC_SUBST(WIN32LDAPP)
1704
1705 case "${host}" in
1706 *-*-cygwin* | *-*-mingw* )
1707 configdir="win"
1708 ;;
1709 *)
1710 configdir="unix"
1711 ;;
1712 esac
1713
1714 GDBTKLIBS=
1715 if test "${enable_gdbtk}" = "yes"; then
1716
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
1724 SC_PATH_TCLCONFIG
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
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)
1761
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"
1809 fi
1810
1811 AC_CONFIG_SUBDIRS(gdbtk)
1812 fi
1813 fi
1814
1815 AC_SUBST(X_CFLAGS)
1816 AC_SUBST(X_LDFLAGS)
1817 AC_SUBST(X_LIBS)
1818 AC_SUBST(GDBTKLIBS)
1819 AC_SUBST(GDBTK_CFLAGS)
1820 AC_SUBST(GDBTK_SRC_DIR)
1821
1822 AC_PATH_X
1823
1824 # Unlike the sim directory, whether a simulator is linked is controlled by
1825 # presence of a gdb_sim definition in the target configure.tgt entry.
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
1829 # not part of the source tree.
1830 #
1831 AC_ARG_ENABLE(sim,
1832 AS_HELP_STRING([--enable-sim], [link gdb with simulator]),
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
1842 if test ! -d "${srcdir}/../sim"; then
1843 ignore_sim=true
1844 fi
1845
1846 SIM=
1847 SIM_OBS=
1848 if test "${ignore_sim}" = "false"; then
1849 if test x"${gdb_sim}" != x ; then
1850 SIM="${gdb_sim}"
1851 SIM_OBS="remote-sim.o"
1852 AC_DEFINE(WITH_SIM, 1, [Define if the simulator is being linked in.])
1853 fi
1854 fi
1855 AC_SUBST(SIM)
1856 AC_SUBST(SIM_OBS)
1857
1858 AC_SUBST(ENABLE_CFLAGS)
1859 AC_SUBST(PROFILE_CFLAGS)
1860
1861 AC_SUBST(CONFIG_OBS)
1862 AC_SUBST(CONFIG_DEPS)
1863 AC_SUBST(CONFIG_SRCS)
1864 AC_SUBST(CONFIG_ALL)
1865 AC_SUBST(CONFIG_CLEAN)
1866 AC_SUBST(CONFIG_INSTALL)
1867 AC_SUBST(CONFIG_UNINSTALL)
1868
1869 # List of host floatformats.
1870 AC_DEFINE_UNQUOTED(GDB_HOST_FLOAT_FORMAT,$gdb_host_float_format,[Host float floatformat])
1871 AC_DEFINE_UNQUOTED(GDB_HOST_DOUBLE_FORMAT,$gdb_host_double_format,[Host double floatformat])
1872 AC_DEFINE_UNQUOTED(GDB_HOST_LONG_DOUBLE_FORMAT,$gdb_host_long_double_format,[Host long double floatformat])
1873
1874 # target_subdir is used by the testsuite to find the target libraries.
1875 target_subdir=
1876 if test "${host}" != "${target}"; then
1877 target_subdir="${target_alias}/"
1878 fi
1879 AC_SUBST(target_subdir)
1880
1881 frags=
1882 if test "${gdb_native}" = "yes"; then
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"
1888 else
1889 host_makefile_frag=/dev/null
1890 fi
1891
1892 AC_SUBST_FILE(host_makefile_frag)
1893 AC_SUBST(frags)
1894
1895 changequote(,)dnl
1896 if test "${gdb_native}" = "yes"; then
1897 # We pick this up from the host configuration file (.mh) because we
1898 # do not have a native configuration Makefile fragment.
1899 nativefile=`sed -n '
1900 s/NAT_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
1901 ' ${host_makefile_frag}`
1902 fi
1903 changequote([,])
1904
1905 if 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.])
1908 fi
1909
1910 # Enable multi-ice-gdb-server.
1911 AC_ARG_ENABLE(multi-ice,
1912 AS_HELP_STRING([--enable-multi-ice], [build the multi-ice-gdb-server]),
1913 [case $enableval in
1914 yes | no)
1915 ;;
1916 *) AC_MSG_ERROR([bad value $enableval for --enable-multi-ice]) ;;
1917 esac])
1918 if test "x$enable_multi_ice" = xyes; then
1919 AC_CONFIG_SUBDIRS(multi-ice)
1920 fi
1921
1922 # We only build gdbserver automatically in a native configuration.
1923 if test "$gdb_native" = "yes"; then
1924 AC_MSG_CHECKING(whether gdbserver is supported on this host)
1925 if test "x$build_gdbserver" = xyes; then
1926 AC_MSG_RESULT(yes)
1927 AC_CONFIG_SUBDIRS(gdbserver)
1928 else
1929 AC_MSG_RESULT(no)
1930 fi
1931 fi
1932
1933 # If nativefile (NAT_FILE) is not set in config/*/*.m[ht] files, we link
1934 # to an empty version.
1935
1936 files=
1937 links=
1938
1939 rm -f nm.h
1940 if test "${nativefile}" != ""; then
1941 case "${nativefile}" in
1942 nm-*.h ) GDB_NM_FILE="config/${gdb_host_cpu}/${nativefile}" ;;
1943 * ) GDB_NM_FILE="${nativefile}"
1944 esac
1945 files="${files} ${GDB_NM_FILE}"
1946 links="${links} nm.h"
1947 AC_DEFINE_UNQUOTED(GDB_NM_FILE, "${GDB_NM_FILE}", [nativefile])
1948 fi
1949 AC_SUBST(GDB_NM_FILE)
1950
1951 AC_LINK_FILES($files, $links)
1952
1953 dnl Check for exe extension set on certain hosts (e.g. Win32)
1954 AC_EXEEXT
1955
1956 dnl Detect the character set used by this host.
1957 dnl At the moment, we just assume it's UTF-8.
1958 AC_DEFINE(GDB_DEFAULT_HOST_CHARSET, "UTF-8",
1959 [Define to be a string naming the default host character set.])
1960
1961 # Flags needed to enable html installing and building
1962 AC_ARG_WITH(datarootdir,
1963 AC_HELP_STRING([--with-datarootdir], [use datarootdir as the data root directory.]),
1964 [datarootdir="\${prefix}/${withval}"],
1965 [datarootdir="\${prefix}/share"])
1966
1967 AC_ARG_WITH(docdir,
1968 AC_HELP_STRING([--with-docdir], [install documentation in this directory.]),
1969 [docdir="\${prefix}/${withval}"],
1970 [docdir="\${datarootdir}/doc"])
1971
1972 AC_ARG_WITH(pdfdir,
1973 AC_HELP_STRING([--with-pdfdir], [install pdf in this directory.]),
1974 [pdfdir="\${prefix}/${withval}"],
1975 [pdfdir="\${docdir}"])
1976
1977 AC_ARG_WITH(htmldir,
1978 AC_HELP_STRING([--with-htmldir], [install html in this directory.]),
1979 [htmldir="\${prefix}/${withval}"],
1980 [htmldir="\${docdir}"])
1981
1982 AC_SUBST(datarootdir)
1983 AC_SUBST(docdir)
1984 AC_SUBST(htmldir)
1985 AC_SUBST(pdfdir)
1986
1987 AC_OUTPUT(Makefile .gdbinit:gdbinit.in gnulib/Makefile,
1988 [
1989 case x$CONFIG_HEADERS in
1990 xconfig.h:config.in)
1991 echo > stamp-h ;;
1992 esac
1993 ])
1994
1995 exit 0
This page took 0.08657 seconds and 5 git commands to generate.