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