* configure.in: Call AC_GNU_SOURCE. Check for pread64 using
[deliverable/binutils-gdb.git] / gdb / configure.in
CommitLineData
c906108c 1dnl Autoconf configure script for GDB, the GNU debugger.
9a156167 2dnl Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
b6ba6518 3dnl Free Software Foundation, Inc.
c906108c
SS
4dnl
5dnl This file is part of GDB.
6dnl
7dnl This program is free software; you can redistribute it and/or modify
8dnl it under the terms of the GNU General Public License as published by
9dnl the Free Software Foundation; either version 2 of the License, or
10dnl (at your option) any later version.
11dnl
12dnl This program is distributed in the hope that it will be useful,
13dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
14dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15dnl GNU General Public License for more details.
16dnl
17dnl You should have received a copy of the GNU General Public License
18dnl along with this program; if not, write to the Free Software
19dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
21dnl Process this file with autoconf to produce a configure script.
22
23AC_PREREQ(2.13)dnl
24AC_INIT(main.c)
25AC_CONFIG_HEADER(config.h:config.in)
413ccac7 26AM_MAINTAINER_MODE
c906108c
SS
27
28AC_PROG_CC
14abd0fb 29AC_GNU_SOURCE
c906108c
SS
30AC_AIX
31AC_ISC_POSIX
32AM_PROG_CC_STDC
33
34AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/..)
35AC_CANONICAL_SYSTEM
36
8bb2c122
MK
37# FIXME: kettenis/20030102: The AC_PROG_RANLIB from Autoconf 2.13
38# doesn't support cross-compilation, but the one from Autoconf 2.5x
39# does. Override RANLIB here (i.e. before running AC_PROG_RANLIB) to
40# deal with the lossage. Note that CY_GNU_GETTEXT currently calls
41# AC_PROG_RANLIB. This can be removed when we switch to # Autoconf
42# 2.5x.
43AC_CHECK_TOOL(RANLIB, ranlib, :)
44
0fbb3da7 45dnl Set up for gettext. PACKAGE is used when we call bindtextdomain.
c906108c
SS
46ALL_LINGUAS=
47CY_GNU_GETTEXT
0fbb3da7
TT
48AC_DEFINE(PACKAGE, "gdb", [Name of this package. ])
49
c906108c
SS
50
51dnl List of object files added by configure.
52
53CONFIG_OBS=
66b965bb 54CONFIG_LIB_OBS=
c906108c
SS
55CONFIG_DEPS=
56CONFIG_SRCS=
fb40c209
AC
57CONFIG_INITS=
58ENABLE_CFLAGS=
b3a90332
AC
59CONFIG_ALL=
60CONFIG_CLEAN=
e56ac5c3
AC
61CONFIG_INSTALL=
62CONFIG_UNINSTALL=
c906108c 63
8dcde887
MK
64AC_CONFIG_SUBDIRS(doc testsuite)
65configdirs=
96baa820 66
27e9bf90 67. $srcdir/configure.host
c906108c 68
27e9bf90 69. $srcdir/configure.tgt
c906108c 70
27e9bf90
MK
71# Fetch the default architecture and default target vector from BFD.
72targ=$target; . $srcdir/../bfd/config.bfd
5c8cc331 73
27e9bf90
MK
74# We only want the first architecture, so strip off the others if
75# there is more than one.
76targ_archs=`echo $targ_archs | sed 's/ .*//'`
5c8cc331 77
27e9bf90
MK
78if test "x$targ_archs" != x; then
79 AC_DEFINE_UNQUOTED(DEFAULT_BFD_ARCH, $targ_archs,
80 [Define to BFD's default architecture. ])
1ba607ad 81fi
27e9bf90
MK
82if test "x$targ_defvec" != x; then
83 AC_DEFINE_UNQUOTED(DEFAULT_BFD_VEC, $targ_defvec,
84 [Define to BFD's default target vector. ])
1ba607ad
AC
85fi
86
8bb2c122
MK
87AC_ARG_PROGRAM
88
627af7ea
MK
89# The CLI cannot be disabled yet, but may be in the future.
90
91# Enable CLI.
92AC_ARG_ENABLE(gdbcli,
93[ --disable-gdbcli disable command-line interface (CLI)],
94 [case $enableval in
95 yes)
96 ;;
97 no)
98 AC_MSG_ERROR([the command-line interface cannot be disabled yet]) ;;
99 *)
100 AC_MSG_ERROR([bad value $enableval for --enable-gdbcli]) ;;
101 esac],
102 [enable_gdbcli=yes])
103if test x"$enable_gdbcli" = xyes; then
104 if test -d $srcdir/cli; then
105 CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_CLI_OBS)"
106 CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_CLI_DEPS)"
107 CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_CLI_SRCS)"
108 CONFIG_INITS="$CONFIG_INITS \$(SUBDIR_CLI_INITS)"
109 ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_CLI_CFLAGS)"
110 CONFIG_ALL="$CONFIG_ALL \$(SUBDIR_CLI_ALL)"
111 CONFIG_CLEAN="$CONFIG_CLEAN \$(SUBDIR_CLI_CLEAN)"
112 CONFIG_INSTALL="$CONFIG_INSTALL \$(SUBDIR_CLI_INSTALL)"
113 CONFIG_UNINSTALL="$CONFIG_UNINSTALL \$(SUBDIR_CLI_UNINSTALL)"
114 fi
115fi
116
117# Enable MI.
118AC_ARG_ENABLE(gdbmi,
119[ --disable-gdbmi disable machine-interface (MI)],
120 [case $enableval in
121 yes | no)
122 ;;
123 *)
124 AC_MSG_ERROR([bad value $enableval for --enable-gdbmi]) ;;
125 esac],
126 [enable_gdbmi=yes])
127if test x"$enable_gdbmi" = xyes; then
128 if test -d $srcdir/mi; then
129 CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_MI_OBS)"
130 CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_MI_DEPS)"
131 CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_MI_SRCS)"
132 CONFIG_INITS="$CONFIG_INITS \$(SUBDIR_MI_INITS)"
133 ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_MI_CFLAGS)"
134 CONFIG_ALL="$CONFIG_ALL \$(SUBDIR_MI_ALL)"
135 CONFIG_CLEAN="$CONFIG_CLEAN \$(SUBDIR_MI_CLEAN)"
136 CONFIG_INSTALL="$CONFIG_INSTALL \$(SUBDIR_MI_INSTALL)"
137 CONFIG_UNINSTALL="$CONFIG_UNINSTALL \$(SUBDIR_MI_UNINSTALL)"
138 fi
139fi
140
287c1a40
MK
141# Enable TUI.
142AC_ARG_ENABLE(tui,
143[ --enable-tui enable full-screen terminal user interface (TUI)],
144 [case $enableval in
145 yes | no)
146 ;;
147 *)
148 AC_MSG_ERROR([bad value $enableval for --enable-tui]) ;;
149 esac])
150if test x"$enable_tui" = xyes; then
151 if test -d $srcdir/tui; then
152 CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_TUI_OBS)"
153 CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_TUI_DEPS)"
154 CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_TUI_SRCS)"
155 CONFIG_INITS="$CONFIG_INITS \$(SUBDIR_TUI_INITS)"
156 ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_TUI_CFLAGS)"
157 CONFIG_ALL="$CONFIG_ALL \$(SUBDIR_TUI_ALL)"
158 CONFIG_CLEAN="$CONFIG_CLEAN \$(SUBDIR_TUI_CLEAN)"
159 CONFIG_INSTALL="$CONFIG_INSTALL \$(SUBDIR_TUI_INSTALL)"
160 CONFIG_UNINSTALL="$CONFIG_UNINSTALL \$(SUBDIR_TUI_UNINSTALL)"
161 need_curses=yes
162 fi
163fi
164
8bb2c122
MK
165# --------------------- #
166# Checks for programs. #
167# --------------------- #
168
7a292a7a 169AC_PROG_AWK
c906108c 170AC_PROG_INSTALL
8bb2c122
MK
171AC_PROG_LN_S
172AC_PROG_RANLIB
173AC_PROG_YACC
174
c906108c 175AC_CHECK_TOOL(AR, ar)
95ca63c4
CF
176AC_CHECK_TOOL(DLLTOOL, dlltool)
177AC_CHECK_TOOL(WINDRES, windres)
c906108c 178
8bb2c122 179# Needed for GNU/Hurd.
75c6e08a
MK
180AC_CHECK_TOOL(MIG, mig)
181
9a156167
MK
182# ---------------------- #
183# Checks for libraries. #
184# ---------------------- #
185
186# We might need to link with -lm; most simulators need it.
187AC_CHECK_LIB(m, main)
188
189# We need to link with -lw to get `wctype' on Solaris before Solaris
190# 2.6. Solaris 2.6 and beyond have this function in libc, and have a
191# libw that some versions of the GNU linker cannot hanle (GNU ld 2.9.1
192# is known to have this problem). Therefore we avoid libw if we can.
193AC_CHECK_FUNC(wctype, [],
194 [AC_CHECK_LIB(w, wctype)])
195
196# Some systems (e.g. Solaris) have `socketpair' in libsocket.
197AC_SEARCH_LIBS(socketpair, socket)
198
287c1a40
MK
199# Since GDB uses Readline, we need termcap functionality, so we need
200# to find a library that provides that. When GDB is configured with
201# --enable-tui, we need full curses functionality.
202#
203# FIXME: kettenis/20030102: We seem to prefer HP curses (Hcurses) over
204# Xcurses on HP-UX; see the `-D__HP_CURSES' in the relevant host
205# Makefile fragments. That's why we need to have `Hcurses' before
206# `curses'. I don't see why we should use HP curses if a more
207# standard curses is available, except that according to HP's
208# documentation one needs to compile `-D_XOPEN_SOURCE_EXTENDED' on
209# HP-UX 10.10 and 10.20.
210
211if test "$need_curses" = yes; then
212 AC_SEARCH_LIBS(initscr, [ncurses Hcurses curses], [],
213 [AC_MSG_ERROR([no curses library found])])
214fi
215
216case $host_os in
217 cygwin*)
218 if test -d $srcdir/libtermcap; then
219 LIBS="../libtermcap/libtermcap.a $LIBS"
220 ac_cv_search_tgetent="../libtermcap/libtermcap.a"
221 fi ;;
222 go32*)
223 # ??? Is this really true?
224 ac_cv_search_tgetent="none required"
225 ;;
226 aix*)
227 # Readline prefers curses over termcap on AIX.
228 # ??? Why?
229 AC_SEARCH_LIBS(tgetent, [tinfo ncurses curses termcap])
230 ;;
231esac
232
233# Note: We used to check for libtermlib and libterminfo too, but
234# Readline doesn't, so I think we're safe with leaving them out.
235AC_SEARCH_LIBS(tgetent, [termcap tinfo ncurses Hcurses curses])
236
237if test "$ac_cv_search_tgetent" = no; then
238 AC_MSG_ERROR([no termcap library found])
239fi
240
5ee754fc
MK
241# ------------------------- #
242# Checks for header files. #
243# ------------------------- #
c906108c 244
9608ab8b 245AC_HEADER_DIRENT
5ee754fc 246AC_HEADER_STAT
c906108c 247AC_HEADER_STDC
5ee754fc
MK
248AC_CHECK_HEADERS(link.h)
249AC_CHECK_HEADERS(nlist.h)
250AC_CHECK_HEADERS(poll.h sys/poll.h)
251AC_CHECK_HEADERS(proc_service.h thread_db.h)
252AC_CHECK_HEADERS(stddef.h)
253AC_CHECK_HEADERS(stdlib.h)
254AC_CHECK_HEADERS(stdint.h)
255AC_CHECK_HEADERS(string.h memory.h strings.h)
256AC_CHECK_HEADERS(sys/fault.h)
257AC_CHECK_HEADERS(sys/file.h)
258AC_CHECK_HEADERS(sys/filio.h)
259AC_CHECK_HEADERS(sys/ioctl.h)
260AC_CHECK_HEADERS(sys/param.h)
261AC_CHECK_HEADERS(sys/proc.h)
262AC_CHECK_HEADERS(sys/procfs.h)
263AC_CHECK_HEADERS(sys/ptrace.h ptrace.h)
264AC_CHECK_HEADERS(sys/reg.h sys/debugreg.h)
265AC_CHECK_HEADERS(sys/select.h)
266AC_CHECK_HEADERS(sys/syscall.h)
267AC_CHECK_HEADERS(sys/user.h)
268AC_CHECK_HEADERS(sys/wait.h wait.h)
269AC_CHECK_HEADERS(termios.h termio.h sgtty.h)
270AC_CHECK_HEADERS(unistd.h)
271
272# On Solaris 2.[78], we need to define _MSE_INT_H to avoid a clash
273# between <widec.h> and <wchar.h> that would cause AC_CHECK_HEADERS to
274# think that we don't have <curses.h> if we're using GCC.
275case $host_os in
276 solaris2.[[78]])
277 if test "$GCC" = yes; then
278 AC_DEFINE(_MSE_INT_H, 1,
279 [[Define to 1 to avoid a clash between <widec.h> and <wchar.h> on
280 Solaris 2.[78] when using GCC. ]])
281 fi ;;
282esac
283AC_CHECK_HEADERS(curses.h ncurses.h term.h)
284
285# FIXME: kettenis/20030102: In most cases we include these
286# unconditionally, so what's the point in checking these?
287AC_CHECK_HEADERS(ctype.h time.h)
288
289# ------------------ #
290# Checks for types. #
291# ------------------ #
c906108c 292
5ee754fc
MK
293AC_TYPE_SIGNAL
294
295# ------------------------------------- #
296# Checks for compiler characteristics. #
297# ------------------------------------- #
c906108c
SS
298
299AC_C_CONST
bce58c09 300AC_C_INLINE
c906108c 301
5ee754fc
MK
302# ------------------------------ #
303# Checks for library functions. #
304# ------------------------------ #
305
c906108c 306AC_FUNC_ALLOCA
97bf5e38 307AC_FUNC_MMAP
46711df8 308AC_FUNC_VFORK
97bf5e38
MK
309AC_CHECK_FUNCS(canonicalize_file_name realpath)
310AC_CHECK_FUNCS(poll)
14abd0fb 311AC_CHECK_FUNCS(pread64)
97bf5e38
MK
312AC_CHECK_FUNCS(sbrk)
313AC_CHECK_FUNCS(setpgid setpgrp)
e1ea1d75 314AC_CHECK_FUNCS(sigaction sigprocmask sigsetmask)
97bf5e38
MK
315AC_CHECK_FUNCS(socketpair)
316
72473524
DJ
317dnl AC_FUNC_SETPGRP does not work when cross compiling
318dnl Instead, assume we will have a prototype for setpgrp if cross compiling.
319if test "$cross_compiling" = no; then
320 AC_FUNC_SETPGRP
321else
322 AC_CACHE_CHECK([whether setpgrp takes no argument], ac_cv_func_setpgrp_void,
323 [AC_TRY_COMPILE([
324#include <unistd.h>
325], [
326 if (setpgrp(1,1) == -1)
327 exit (0);
328 else
329 exit (1);
330], ac_cv_func_setpgrp_void=no, ac_cv_func_setpgrp_void=yes)])
331if test $ac_cv_func_setpgrp_void = yes; then
332 AC_DEFINE(SETPGRP_VOID, 1)
333fi
334fi
c906108c 335
2b2d558c
MK
336# Check if sigsetjmp is available. Using AC_CHECK_FUNCS won't do
337# since sigsetjmp might only be defined as a macro.
338AC_CACHE_CHECK([for sigsetjmp], gdb_cv_func_sigsetjmp,
339[AC_TRY_COMPILE([
340#include <setjmp.h>
341], [sigjmp_buf env; while (! sigsetjmp (env, 1)) siglongjmp (env, 1);],
342gdb_cv_func_sigsetjmp=yes, gdb_cv_func_sigsetjmp=no)])
343if test $gdb_cv_func_sigsetjmp = yes; then
344 AC_DEFINE(HAVE_SIGSETJMP, 1, [Define if sigsetjmp is available. ])
345fi
346
06825bd1
MK
347# Assume we'll default to using the included libiberty regex.
348gdb_use_included_regex=yes
349
350# However, if the system regex is GNU regex, then default to *not*
351# using the included regex.
352AC_CACHE_CHECK(
353 [for GNU regex],
354 [gdb_cv_have_gnu_regex],
355 [AC_TRY_COMPILE(
356 [#include <gnu-versions.h>],
357 [#define REGEX_INTERFACE_VERSION 1
358#if _GNU_REGEX_INTERFACE_VERSION != REGEX_INTERFACE_VERSION
359# error "Version mismatch"
360#endif],
361 gdb_cv_have_gnu_regex=yes,
362 gdb_cv_have_gnu_regex=no)])
363if test $gdb_cv_have_gnu_regex = yes; then
364 gdb_use_included_regex=no
365fi
366
367AC_ARG_WITH(included-regex,
368 [ --without-included-regex don't use included regex; this is the default
369 on systems with version 2 of the GNU C library
370 (use with caution on other system)],
371 gdb_with_regex=$withval,
372 gdb_with_regex=$gdb_use_included_regex)
373if test "$gdb_with_regex" = yes; then
374 AC_DEFINE(USE_INCLUDED_REGEX, 1,
375 [Define to 1 if the regex included in libiberty should be used.])
376fi
377
0afdd437 378# See if <machine/reg.h> supports the %fs and %gs i386 segment registers.
7dfa765c 379# Older i386 BSD's don't have the r_fs and r_gs members of `struct reg'.
422ea4b8 380AC_CACHE_CHECK([for r_fs in struct reg], gdb_cv_struct_reg_r_fs,
7dfa765c 381[AC_TRY_COMPILE([#include <machine/reg.h>], [struct reg r; r.r_fs;],
422ea4b8
MK
382gdb_cv_struct_reg_r_fs=yes, gdb_cv_struct_reg_r_fs=no)])
383if test $gdb_cv_struct_reg_r_fs = yes; then
384 AC_DEFINE(HAVE_STRUCT_REG_R_FS)
7dfa765c 385fi
422ea4b8 386AC_CACHE_CHECK([for r_gs in struct reg], gdb_cv_struct_reg_r_gs,
7dfa765c 387[AC_TRY_COMPILE([#include <machine/reg.h>], [struct reg r; r.r_gs;],
422ea4b8
MK
388gdb_cv_struct_reg_r_gs=yes, gdb_cv_struct_reg_r_gs=no)])
389if test $gdb_cv_struct_reg_r_gs = yes; then
390 AC_DEFINE(HAVE_STRUCT_REG_R_GS)
7dfa765c
MK
391fi
392
0afdd437 393# See if <sys/ptrace.h> provides the PTRACE_GETREGS request.
f60300e7
MK
394AC_MSG_CHECKING(for PTRACE_GETREGS)
395AC_CACHE_VAL(gdb_cv_have_ptrace_getregs,
396[AC_TRY_COMPILE([#include <sys/ptrace.h>],
397 [PTRACE_GETREGS;],
398 [gdb_cv_have_ptrace_getregs=yes],
399 [gdb_cv_have_ptrace_getregs=no])])
400AC_MSG_RESULT($gdb_cv_have_ptrace_getregs)
401if test $gdb_cv_have_ptrace_getregs = yes; then
402 AC_DEFINE(HAVE_PTRACE_GETREGS)
403fi
404
0afdd437 405# See if <sys/ptrace.h> provides the PTRACE_GETFPXREGS request.
6ce2ac0b
MK
406AC_MSG_CHECKING(for PTRACE_GETFPXREGS)
407AC_CACHE_VAL(gdb_cv_have_ptrace_getfpxregs,
5c44784c 408[AC_TRY_COMPILE([#include <sys/ptrace.h>],
6ce2ac0b
MK
409 [PTRACE_GETFPXREGS;],
410 [gdb_cv_have_ptrace_getfpxregs=yes],
411 [gdb_cv_have_ptrace_getfpxregs=no])])
412AC_MSG_RESULT($gdb_cv_have_ptrace_getfpxregs)
413if test $gdb_cv_have_ptrace_getfpxregs = yes; then
414 AC_DEFINE(HAVE_PTRACE_GETFPXREGS)
5c44784c
JM
415fi
416
0afdd437
MK
417# See if <sys/ptrace.h> provides the PT_GETDBREGS request.
418AC_MSG_CHECKING(for PT_GETDBREGS)
419AC_CACHE_VAL(gdb_cv_have_pt_getdbregs,
420[AC_TRY_COMPILE([#include <sys/types.h>
421#include <sys/ptrace.h>],
422 [PT_GETDBREGS;],
423 [gdb_cv_have_pt_getdbregs=yes],
424 [gdb_cv_have_pt_getdbregs=no])])
425AC_MSG_RESULT($gdb_cv_have_pt_getdbregs)
426if test $gdb_cv_have_pt_getdbregs = yes; then
427 AC_DEFINE(HAVE_PT_GETDBREGS)
428fi
429
7e89e357
JT
430# See if <sys/ptrace.h> provides the PT_GETXMMREGS request.
431AC_MSG_CHECKING(for PT_GETXMMREGS)
432AC_CACHE_VAL(gdb_cv_have_pt_getxmmregs,
433[AC_TRY_COMPILE([#include <sys/types.h>
434#include <sys/ptrace.h>],
435 [PT_GETXMMREGS;],
436 [gdb_cv_have_pt_getxmmregs=yes],
437 [gdb_cv_have_pt_getxmmregs=no])])
438AC_MSG_RESULT($gdb_cv_have_pt_getxmmregs)
439if test $gdb_cv_have_pt_getxmmregs = yes; then
440 AC_DEFINE(HAVE_PT_GETXMMREGS)
441fi
442
0afdd437 443
c906108c
SS
444BFD_NEED_DECLARATION(malloc)
445BFD_NEED_DECLARATION(realloc)
446BFD_NEED_DECLARATION(free)
447BFD_NEED_DECLARATION(strerror)
448BFD_NEED_DECLARATION(strdup)
b83266a0 449BFD_NEED_DECLARATION(strstr)
a4db0f07 450BFD_NEED_DECLARATION(canonicalize_file_name)
c906108c
SS
451
452# The following save_state_t checkery is only necessary for HPUX
453# versions earlier than 10.20. When those fade from memory, this
454# could be expunged. --jsm 1999-03-22
455
456AC_MSG_CHECKING(for HPUX save_state structure)
457AC_EGREP_HEADER(save_state_t, machine/save_state.h,
458 gdb_cv_hpux_savestate=yes, gdb_cv_hpux_savestate=no)
459AC_EGREP_HEADER(ss_wide, machine/save_state.h, gdb_cv_hpux_sswide=yes,
460 gdb_cv_hpux_sswide=no)
461if test $gdb_cv_hpux_savestate = yes
462then
463 AC_DEFINE(HAVE_STRUCT_SAVE_STATE_T, 1)
464fi
465if test $gdb_cv_hpux_sswide = yes
466then
467 AC_DEFINE(HAVE_STRUCT_MEMBER_SS_WIDE, 1)
468fi
469AC_MSG_RESULT($gdb_cv_hpux_sswide)
470
471
472# If we are configured native on GNU/Linux, work around problems with
473# sys/procfs.h
c3f6f71d 474# Also detect which type of /proc is in use, such as for Unixware or Solaris.
c906108c
SS
475
476if test "${target}" = "${host}"; then
477 case "${host}" in
478 i[[3456]]86-*-linux*)
479 AC_DEFINE(START_INFERIOR_TRAPS_EXPECTED,2)
480 AC_DEFINE(sys_quotactl)
481 ;;
596c9d4b
KB
482 ia64-*-aix*)
483 AC_DEFINE(NEW_PROC_API)
484 ;;
1045b512 485 *-*-unixware* | *-*-sysv4.2* | *-*-sysv5* | *-*-interix* )
c3f6f71d
JM
486 AC_DEFINE(NEW_PROC_API)
487 ;;
3423db82 488 *-*-solaris2.[[678]])
c3f6f71d
JM
489 AC_DEFINE(NEW_PROC_API)
490 ;;
c906108c 491 esac
c906108c
SS
492fi
493
494if test "$ac_cv_header_sys_procfs_h" = yes; then
495 BFD_HAVE_SYS_PROCFS_TYPE(pstatus_t)
496 BFD_HAVE_SYS_PROCFS_TYPE(prrun_t)
497 BFD_HAVE_SYS_PROCFS_TYPE(gregset_t)
498 BFD_HAVE_SYS_PROCFS_TYPE(fpregset_t)
83d37ec8
MK
499 BFD_HAVE_SYS_PROCFS_TYPE(prgregset_t)
500 BFD_HAVE_SYS_PROCFS_TYPE(prfpregset_t)
23e04971
MS
501 BFD_HAVE_SYS_PROCFS_TYPE(prgregset32_t)
502 BFD_HAVE_SYS_PROCFS_TYPE(prfpregset32_t)
83d37ec8
MK
503 BFD_HAVE_SYS_PROCFS_TYPE(lwpid_t)
504 BFD_HAVE_SYS_PROCFS_TYPE(psaddr_t)
596c9d4b
KB
505 BFD_HAVE_SYS_PROCFS_TYPE(prsysent_t)
506 BFD_HAVE_SYS_PROCFS_TYPE(pr_sigset_t)
507 BFD_HAVE_SYS_PROCFS_TYPE(pr_sigaction64_t)
508 BFD_HAVE_SYS_PROCFS_TYPE(pr_siginfo64_t)
c906108c 509
23e04971 510
d84dd0c5
MK
511 dnl Check for broken prfpregset_t type
512
513 dnl For Linux/i386, glibc 2.1.3 was released with a bogus
514 dnl prfpregset_t type (it's a typedef for the pointer to a struct
515 dnl instead of the struct itself). We detect this here, and work
a3007b6f 516 dnl around it in gdb_proc_service.h.
d84dd0c5
MK
517
518 if test $bfd_cv_have_sys_procfs_type_prfpregset_t = yes; then
519 AC_MSG_CHECKING(whether prfpregset_t type is broken)
520 AC_CACHE_VAL(gdb_cv_prfpregset_t_broken,
521 [AC_TRY_RUN([#include <sys/procfs.h>
522 int main ()
523 {
524 if (sizeof (prfpregset_t) == sizeof (void *))
525 return 1;
526 return 0;
527 }],
528 gdb_cv_prfpregset_t_broken=no,
529 gdb_cv_prfpregset_t_broken=yes,
530 gdb_cv_prfpregset_t_broken=yes)])
531 AC_MSG_RESULT($gdb_cv_prfpregset_t_broken)
532 if test $gdb_cv_prfpregset_t_broken = yes; then
533 AC_DEFINE(PRFPREGSET_T_BROKEN)
534 fi
535 fi
536
c906108c
SS
537 dnl Check for PIOCSET ioctl entry
538
539 AC_MSG_CHECKING(for PIOCSET ioctl entry in sys/procfs.h)
540 AC_CACHE_VAL(gdb_cv_have_procfs_piocset,
541 [AC_TRY_COMPILE([#include <unistd.h>
542#include <sys/types.h>
543#include <sys/procfs.h>
544], [
545 int dummy;;
546 dummy = ioctl(0, PIOCSET, &dummy);
547 ],
548 gdb_cv_have_procfs_piocset=yes, gdb_cv_have_procfs_piocset=no)])
549 AC_MSG_RESULT($gdb_cv_have_procfs_piocset)
550 if test $gdb_cv_have_procfs_piocset = yes; then
551 AC_DEFINE(HAVE_PROCFS_PIOCSET)
552 fi
553fi
554
d45fe813
KB
555dnl For native ports (host == target), check to see what kind of
556dnl legacy link.h support is needed. (See solib-legacy.c.)
557if test ${host} = ${target} ; then
558 dnl Check for struct link_map with l_ members which are indicative
559 dnl of SVR4-like shared libraries
560
561 AC_MSG_CHECKING(for member l_addr in struct link_map)
562 AC_CACHE_VAL(gdb_cv_have_struct_link_map_with_l_members,
563 [AC_TRY_COMPILE([#include <link.h>],
564 [struct link_map lm; (void) lm.l_addr;],
565 gdb_cv_have_struct_link_map_with_l_members=yes,
566 gdb_cv_have_struct_link_map_with_l_members=no)])
567 AC_MSG_RESULT($gdb_cv_have_struct_link_map_with_l_members)
568 if test $gdb_cv_have_struct_link_map_with_l_members = yes; then
569 AC_DEFINE(HAVE_STRUCT_LINK_MAP_WITH_L_MEMBERS)
570 fi
571
572 dnl Check for struct link_map with lm_ members which are indicative
573 dnl of SunOS-like shared libraries
574
575 AC_MSG_CHECKING(for member lm_addr in struct link_map)
576 AC_CACHE_VAL(gdb_cv_have_struct_link_map_with_lm_members,
577 [AC_TRY_COMPILE([#include <sys/types.h>
578#include <link.h>],
579 [struct link_map lm; (void) lm.lm_addr;],
580 gdb_cv_have_struct_link_map_with_lm_members=yes,
581 gdb_cv_have_struct_link_map_with_lm_members=no)])
582 AC_MSG_RESULT($gdb_cv_have_struct_link_map_with_lm_members)
583 if test $gdb_cv_have_struct_link_map_with_lm_members = yes; then
584 AC_DEFINE(HAVE_STRUCT_LINK_MAP_WITH_LM_MEMBERS)
585 fi
586
587 dnl Check for struct so_map with som_ members which are found on
588 dnl some *BSD systems.
589
590 AC_MSG_CHECKING(for member som_addr in struct so_map)
591 AC_CACHE_VAL(gdb_cv_have_struct_so_map_with_som_members,
592 [AC_TRY_COMPILE([#include <sys/types.h>
39812ceb
C
593#ifdef HAVE_NLIST_H
594#include <nlist.h>
595#endif
d45fe813
KB
596#include <link.h>],
597 [struct so_map lm; (void) lm.som_addr;],
598 gdb_cv_have_struct_so_map_with_som_members=yes,
599 gdb_cv_have_struct_so_map_with_som_members=no)])
600 AC_MSG_RESULT($gdb_cv_have_struct_so_map_with_som_members)
601 if test $gdb_cv_have_struct_so_map_with_som_members = yes; then
602 AC_DEFINE(HAVE_STRUCT_SO_MAP_WITH_SOM_MEMBERS)
603 fi
604
605 dnl Check for struct link_map32 type, which allows a 64-bit Solaris
606 dnl debugger to debug a 32-bit Solaris app with 32-bit shared libraries.
607
608 AC_MSG_CHECKING(for struct link_map32 in sys/link.h)
609 AC_CACHE_VAL(gdb_cv_have_struct_link_map32,
610 [AC_TRY_COMPILE([#define _SYSCALL32
611#include <sys/link.h>], [struct link_map32 l;],
612 gdb_cv_have_struct_link_map32=yes,
613 gdb_cv_have_struct_link_map32=no)])
614 AC_MSG_RESULT($gdb_cv_have_struct_link_map32)
615 if test $gdb_cv_have_struct_link_map32 = yes; then
616 AC_DEFINE(HAVE_STRUCT_LINK_MAP32)
943c9c25 617 AC_DEFINE(_SYSCALL32)
d45fe813
KB
618 fi
619fi
620
c906108c
SS
621dnl See if compiler supports "long long" type.
622
623AC_MSG_CHECKING(for long long support in compiler)
624AC_CACHE_VAL(gdb_cv_c_long_long,
625[AC_TRY_COMPILE(, [
626 extern long long foo;
627 switch (foo & 2) { case 0: return 1; }
628],
629gdb_cv_c_long_long=yes, gdb_cv_c_long_long=no)])
630AC_MSG_RESULT($gdb_cv_c_long_long)
631if test $gdb_cv_c_long_long = yes; then
632 AC_DEFINE(CC_HAS_LONG_LONG)
633fi
634
635dnl See if the compiler and runtime support printing long long
636
637AC_MSG_CHECKING(for long long support in printf)
638AC_CACHE_VAL(gdb_cv_printf_has_long_long,
639[AC_TRY_RUN([
640int main () {
641 char buf[32];
642 long long l = 0;
643 l = (l << 16) + 0x0123;
644 l = (l << 16) + 0x4567;
645 l = (l << 16) + 0x89ab;
646 l = (l << 16) + 0xcdef;
647 sprintf (buf, "0x%016llx", l);
648 return (strcmp ("0x0123456789abcdef", buf));
649}],
650gdb_cv_printf_has_long_long=yes,
651gdb_cv_printf_has_long_long=no,
652gdb_cv_printf_has_long_long=no)])
653if test $gdb_cv_printf_has_long_long = yes; then
654 AC_DEFINE(PRINTF_HAS_LONG_LONG)
655fi
656AC_MSG_RESULT($gdb_cv_printf_has_long_long)
657
658dnl See if compiler supports "long double" type. Can't use AC_C_LONG_DOUBLE
659dnl because autoconf complains about cross-compilation issues. However, this
660dnl code uses the same variables as the macro for compatibility.
661
662AC_MSG_CHECKING(for long double support in compiler)
663AC_CACHE_VAL(ac_cv_c_long_double,
664[AC_TRY_COMPILE(, [long double foo;],
665ac_cv_c_long_double=yes, ac_cv_c_long_double=no)])
666AC_MSG_RESULT($ac_cv_c_long_double)
667if test $ac_cv_c_long_double = yes; then
668 AC_DEFINE(HAVE_LONG_DOUBLE)
669fi
670
671dnl See if the compiler and runtime support printing long doubles
672
673AC_MSG_CHECKING(for long double support in printf)
674AC_CACHE_VAL(gdb_cv_printf_has_long_double,
675[AC_TRY_RUN([
676int main () {
677 char buf[16];
678 long double f = 3.141592653;
679 sprintf (buf, "%Lg", f);
680 return (strncmp ("3.14159", buf, 7));
681}],
682gdb_cv_printf_has_long_double=yes,
683gdb_cv_printf_has_long_double=no,
684gdb_cv_printf_has_long_double=no)])
685if test $gdb_cv_printf_has_long_double = yes; then
686 AC_DEFINE(PRINTF_HAS_LONG_DOUBLE)
687fi
688AC_MSG_RESULT($gdb_cv_printf_has_long_double)
689
690dnl See if the compiler and runtime support scanning long doubles
691
692AC_MSG_CHECKING(for long double support in scanf)
693AC_CACHE_VAL(gdb_cv_scanf_has_long_double,
694[AC_TRY_RUN([
695int main () {
696 char *buf = "3.141592653";
697 long double f = 0;
698 sscanf (buf, "%Lg", &f);
699 return !(f > 3.14159 && f < 3.14160);
700}],
701gdb_cv_scanf_has_long_double=yes,
702gdb_cv_scanf_has_long_double=no,
703gdb_cv_scanf_has_long_double=no)])
704if test $gdb_cv_scanf_has_long_double = yes; then
705 AC_DEFINE(SCANF_HAS_LONG_DOUBLE)
706fi
707AC_MSG_RESULT($gdb_cv_scanf_has_long_double)
708
438013df
AO
709case ${host_os} in
710aix*)
711 AC_CACHE_CHECK([for -bbigtoc option], [gdb_cv_bigtoc], [
712 SAVE_LDFLAGS=$LDFLAGS
713
714 case $GCC in
715 yes) gdb_cv_bigtoc=-Wl,-bbigtoc ;;
716 *) gdb_cv_bigtoc=-bbigtoc ;;
717 esac
718
719 LDFLAGS=$LDFLAGS\ $gdb_cv_bigtoc
720 AC_TRY_LINK([], [int i;], [], [gdb_cv_bigtoc=])
721 ])
722 CONFIG_LDFLAGS="${CONFIG_LDFLAGS} ${gdb_cv_bigtoc}"
723 ;;
724esac
725
c906108c 726
d92419e5
JB
727dnl For certain native configurations, we need to check whether thread
728dnl support can be built in or not.
729dnl
730dnl Note that we only want this if we are both native (host == target),
731dnl and not doing a canadian cross build (build == host).
c906108c
SS
732
733if test ${build} = ${host} -a ${host} = ${target} ; then
734 case ${host_os} in
735 hpux*)
736 AC_MSG_CHECKING(for HPUX/OSF thread support)
737 if test -f /usr/include/dce/cma_config.h ; then
738 if test "$GCC" = "yes" ; then
739 AC_MSG_RESULT(yes)
740 AC_DEFINE(HAVE_HPUX_THREAD_SUPPORT)
66b965bb 741 CONFIG_LIB_OBS="${CONFIG_LIB_OBS} hpux-thread.o"
c906108c
SS
742 CONFIG_SRCS="${CONFIG_SRCS} hpux-thread.c"
743 else
744 AC_MSG_RESULT(no (suppressed because you are not using GCC))
745 fi
746 else
747 AC_MSG_RESULT(no)
748 fi
749 ;;
750 solaris*)
d92419e5
JB
751 # See if thread_db library is around for Solaris thread debugging.
752 # Note that we must explicitly test for version 1 of the library
753 # because version 0 (present on Solaris 2.4 or earlier) doesn't have
754 # the same API.
c906108c
SS
755 AC_MSG_CHECKING(for Solaris thread debugging library)
756 if test -f /usr/lib/libthread_db.so.1 ; then
757 AC_MSG_RESULT(yes)
758 AC_DEFINE(HAVE_THREAD_DB_LIB)
66b965bb 759 CONFIG_LIB_OBS="${CONFIG_LIB_OBS} sol-thread.o"
c906108c
SS
760 CONFIG_SRCS="${CONFIG_SRCS} sol-thread.c"
761 AC_CHECK_LIB(dl, dlopen)
762 if test "$GCC" = "yes" ; then
763 # The GNU linker requires the -export-dynamic option to make
764 # all symbols visible in the dynamic symbol table.
765 hold_ldflags=$LDFLAGS
766 AC_MSG_CHECKING(for the ld -export-dynamic flag)
767 LDFLAGS="${LDFLAGS} -Wl,-export-dynamic"
768 AC_TRY_LINK(, [int i;], found=yes, found=no)
769 LDFLAGS=$hold_ldflags
770 AC_MSG_RESULT($found)
771 if test $found = yes; then
772 CONFIG_LDFLAGS="${CONFIG_LDFLAGS} -Wl,-export-dynamic"
773 fi
774 fi
775 # Sun randomly tweaked the prototypes in <proc_service.h>
776 # at one point.
777 AC_MSG_CHECKING(if <proc_service.h> is old)
778 AC_CACHE_VAL(gdb_cv_proc_service_is_old,[
779 AC_TRY_COMPILE([
780 #include <proc_service.h>
781 ps_err_e ps_pdwrite
782 (struct ps_prochandle*, psaddr_t, const void*, size_t);
783 ],, gdb_cv_proc_service_is_old=no,
784 gdb_cv_proc_service_is_old=yes)
785 ])
786 AC_MSG_RESULT($gdb_cv_proc_service_is_old)
787 if test $gdb_cv_proc_service_is_old = yes; then
788 AC_DEFINE(PROC_SERVICE_IS_OLD)
789 fi
790 else
791 AC_MSG_RESULT(no)
792 fi
793 ;;
d92419e5
JB
794 aix*)
795 AC_MSG_CHECKING(for AiX thread debugging library)
796 AC_CACHE_VAL(gdb_cv_have_aix_thread_debug,
797 [AC_TRY_COMPILE([#include <sys/pthdebug.h>],
798 [#ifndef PTHDB_VERSION_3
799 #error
800 #endif],
801 gdb_cv_have_aix_thread_debug=yes,
802 gdb_cv_have_aix_thread_debug=no)])
803 AC_MSG_RESULT($gdb_cv_have_aix_thread_debug)
804 if test $gdb_cv_have_aix_thread_debug = yes; then
805 CONFIG_SRCS="${CONFIG_SRCS} aix-thread.c"
806 CONFIG_LIB_OBS="${CONFIG_LIB_OBS} aix-thread.o"
807 CONFIG_LDFLAGS="${CONFIG_LDFLAGS} -lpthdebug"
808 fi
809 ;;
c906108c
SS
810 esac
811 AC_SUBST(CONFIG_LDFLAGS)
812fi
813
3f47be5c
EZ
814dnl See if we have a thread_db header file that has TD_NOTALLOC.
815if test "x$ac_cv_header_thread_db_h" = "xyes"; then
816 AC_CACHE_CHECK([whether <thread_db.h> has TD_NOTALLOC],
817 gdb_cv_thread_db_h_has_td_notalloc,
818 AC_TRY_COMPILE(
819 [#include <thread_db.h>],
820 [int i = TD_NOTALLOC;],
821 gdb_cv_thread_db_h_has_td_notalloc=yes,
822 gdb_cv_thread_db_h_has_td_notalloc=no
823 )
824 )
825fi
826if test "x$gdb_cv_thread_db_h_has_td_notalloc" = "xyes"; then
827 AC_DEFINE(THREAD_DB_HAS_TD_NOTALLOC, 1,
828 [Define if <thread_db.h> has the TD_NOTALLOC error code.])
829fi
830
c906108c 831dnl Handle optional features that can be enabled.
fb40c209 832
3b851bce
AC
833# NOTE: Don't add -Wall or -Wunused, they both include
834# -Wunused-parameter which reports bogus warnings.
835# NOTE: If you add to this list, remember to update
836# gdb/doc/gdbint.texinfo.
1decb323 837build_warnings="-Wimplicit -Wreturn-type -Wcomment -Wtrigraphs \
93d56215 838-Wformat -Wparentheses -Wpointer-arith -Wuninitialized"
d8038014
AC
839# Up for debate: -Wswitch -Wcomment -trigraphs -Wtrigraphs
840# -Wunused-function -Wunused-label -Wunused-variable -Wunused-value
93d56215 841# -Wchar-subscripts -Wtraditional -Wshadow -Wcast-qual
d8038014
AC
842# -Wcast-align -Wwrite-strings -Wconversion -Wstrict-prototypes
843# -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls
844# -Woverloaded-virtual -Winline -Werror"
c906108c
SS
845AC_ARG_ENABLE(build-warnings,
846[ --enable-build-warnings Enable build-time compiler warnings if gcc is used],
1decb323 847[case "${enableval}" in
c906108c
SS
848 yes) ;;
849 no) build_warnings="-w";;
850 ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
851 build_warnings="${build_warnings} ${t}";;
852 *,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
853 build_warnings="${t} ${build_warnings}";;
854 *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
d4f3574e
SS
855esac
856if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
746a987d 857 echo "Setting compiler warning flags = $build_warnings" 6>&1
1decb323 858fi])dnl
3b851bce
AC
859AC_ARG_ENABLE(gdb-build-warnings,
860[ --enable-gdb-build-warnings Enable GDB specific build-time compiler warnings if gcc is used],
861[case "${enableval}" in
862 yes) ;;
863 no) build_warnings="-w";;
864 ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
865 build_warnings="${build_warnings} ${t}";;
866 *,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
867 build_warnings="${t} ${build_warnings}";;
868 *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
869esac
870if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
871 echo "Setting GDB specific compiler warning flags = $build_warnings" 6>&1
872fi])dnl
104c1213
JM
873WARN_CFLAGS=""
874WERROR_CFLAGS=""
c906108c
SS
875if test "x${build_warnings}" != x -a "x$GCC" = xyes
876then
746a987d
AC
877 AC_MSG_CHECKING(compiler warning flags)
878 # Separate out the -Werror flag as some files just cannot be
879 # compiled with it enabled.
880 for w in ${build_warnings}; do
881 case $w in
882 -Werr*) WERROR_CFLAGS=-Werror ;;
883 *) # Check that GCC accepts it
4536bbc6
AC
884 saved_CFLAGS="$CFLAGS"
885 CFLAGS="$CFLAGS $w"
886 AC_TRY_COMPILE([],[],WARN_CFLAGS="${WARN_CFLAGS} $w",)
887 CFLAGS="$saved_CFLAGS"
746a987d
AC
888 esac
889 done
890 AC_MSG_RESULT(${WARN_CFLAGS}${WERROR_CFLAGS})
1decb323 891fi
c906108c 892AC_SUBST(WARN_CFLAGS)
104c1213 893AC_SUBST(WERROR_CFLAGS)
c906108c
SS
894
895MMALLOC_CFLAGS=
896MMALLOC=
897AC_SUBST(MMALLOC_CFLAGS)
898AC_SUBST(MMALLOC)
899
900AC_ARG_WITH(mmalloc,
901[ --with-mmalloc Use memory mapped malloc package],
902[case "${withval}" in
903 yes) want_mmalloc=true ;;
904 no) want_mmalloc=false;;
905 *) AC_MSG_ERROR(bad value ${withval} for GDB with-mmalloc option) ;;
906esac],[want_mmalloc=false])dnl
907
908if test x$want_mmalloc = xtrue; then
909 AC_DEFINE(USE_MMALLOC)
910 AC_DEFINE(MMCHECK_FORCE)
911 MMALLOC_CFLAGS="-I$srcdir/../mmalloc"
912 MMALLOC='../mmalloc/libmmalloc.a'
913fi
914
7a292a7a
SS
915# In the Cygwin environment, we need some additional flags.
916AC_CACHE_CHECK([for cygwin], gdb_cv_os_cygwin,
917[AC_EGREP_CPP(lose, [
918#if defined (__CYGWIN__) || defined (__CYGWIN32__)
919lose
920#endif],[gdb_cv_os_cygwin=yes],[gdb_cv_os_cygwin=no])])
921
aff38e61
AC
922
923dnl Figure out which of the many generic ser-*.c files the _host_ supports.
924SER_HARDWIRE="ser-unix.o ser-pipe.o ser-tcp.o"
925case ${host} in
95cbc983
AC
926 *go32* ) SER_HARDWIRE=ser-go32.o ;;
927 *djgpp* ) SER_HARDWIRE=ser-go32.o ;;
aff38e61
AC
928esac
929AC_SUBST(SER_HARDWIRE)
930
cd0fc7c3
SS
931# libreadline needs libuser32.a in a cygwin environment
932WIN32LIBS=
933if test x$gdb_cv_os_cygwin = xyes; then
c5394b80
JM
934 WIN32LIBS="-luser32"
935 case "${target}" in
936 *cygwin*) WIN32LIBS="$WIN32LIBS -limagehlp"
937 ;;
938 esac
cd0fc7c3
SS
939fi
940AC_SUBST(WIN32LIBS)
7a292a7a 941
3fc11d3e
JM
942LIBGUI="../libgui/src/libgui.a"
943GUI_CFLAGS_X="-I${srcdir}/../libgui/src"
944AC_SUBST(LIBGUI)
945AC_SUBST(GUI_CFLAGS_X)
7a292a7a 946
3fc11d3e
JM
947AC_ARG_ENABLE(gdbtk,
948[ --enable-gdbtk Enable GDBTK GUI front end],
949[case "${enableval}" in
950 yes)
951 case "$host" in
952 *go32*)
953 AC_MSG_WARN([GDB does not support GDBtk on host ${host}. GDBtk will be disabled.])
954 enable_gdbtk=no ;;
955 *windows*)
956 AC_MSG_WARN([GDB does not support GDBtk on host ${host}. GDBtk will be disabled.])
957 enable_gdbtk=no ;;
958 *)
959 enable_gdbtk=yes ;;
960 esac ;;
961 no)
962 enable_gdbtk=no ;;
963 *)
964 AC_MSG_ERROR(bad value ${enableval} given for gdbtk option) ;;
965esac],
966[
967# Default is on for everything but go32 and Cygwin
968case "$host" in
969 *go32* | *windows*)
970 ;;
971 *)
379d6434
AC
972 if test -d "${srcdir}/gdbtk" ; then
973 enable_gdbtk=yes
974 fi
975 ;;
976esac
3fc11d3e
JM
977])
978
979WIN32LDAPP=
980AC_SUBST(WIN32LIBS)
981AC_SUBST(WIN32LDAPP)
982
983configdir="unix"
984
985GDBTKLIBS=
986if test "${enable_gdbtk}" = "yes"; then
987
d1c3b63a
KS
988 # Gdbtk must have an absolute path to srcdir in order to run
989 # properly when not installed.
990 here=`pwd`
991 cd ${srcdir}
992 GDBTK_SRC_DIR=`pwd`
993 cd $here
994
3fc11d3e
JM
995 CY_AC_PATH_TCLCONFIG
996 if test -z "${no_tcl}"; then
997 CY_AC_LOAD_TCLCONFIG
998 CY_AC_PATH_TKCONFIG
999
dd2504ab
JM
1000 # now look for Tcl library stuff
1001
1002 case "${host}" in
1003 *-*-cygwin*)
1004 tcldir=../tcl/win/
1005 ;;
1006 *)
1007 tcldir=../tcl/unix/
1008 ;;
1009 esac
1010
1011 TCL_DEPS="${tcldir}${TCL_LIB_FILE}"
1012
3fc11d3e
JM
1013 # If $no_tk is nonempty, then we can't do Tk, and there is no
1014 # point to doing Tcl.
1015 if test -z "${no_tk}"; then
1016 CY_AC_LOAD_TKCONFIG
1017 CY_AC_PATH_TCLH
1018 CY_AC_PATH_TKH
1019 CY_AC_PATH_ITCLH
1020 CY_AC_PATH_ITKH
3fc11d3e 1021
dd2504ab
JM
1022
1023 # now look for Tk library stuff
1024
1025 case "${host}" in
1026 *-*-cygwin*)
1027 tkdir=../tk/win/
1028 ;;
1029 *)
1030 tkdir=../tk/unix/
1031 ;;
1032 esac
1033
1034 TK_DEPS="${tkdir}${TK_LIB_FILE}"
1035
3fc11d3e
JM
1036 # now look for Itcl library stuff
1037
1038 CY_AC_PATH_ITCLCONFIG
1039 if test -z "${no_itcl}"; then
b381d62d 1040 CY_AC_LOAD_ITCLCONFIG
3fc11d3e
JM
1041
1042 ITCLLIB="${ITCL_BUILD_LIB_SPEC}"
b381d62d 1043 ITCL_DEPS="${ITCL_LIB_FULL_PATH}"
3fc11d3e
JM
1044 fi
1045
1046
1047 # now look for Itk library stuff
1048 CY_AC_PATH_ITKCONFIG
1049 if test -z "${no_itcl}"; then
1050 CY_AC_LOAD_ITKCONFIG
1051
3fc11d3e 1052 ITKLIB="${ITK_BUILD_LIB_SPEC}"
b381d62d 1053 ITK_DEPS="${ITK_LIB_FULL_PATH}"
3fc11d3e
JM
1054 fi
1055
4226a5a5 1056 ENABLE_CFLAGS="${ENABLE_CFLAGS} \$(SUBDIR_GDBTK_CFLAGS)"
3fc11d3e
JM
1057 # Tcl/Tk 8.1 require -fwritable strings. I don't
1058 # know whether 8.2 will or not, but I bet it will.
1059 # I don't have to worry about 7.x since we don't support it.
1060 GDBTK_CFLAGS=""
1061 if test "$GCC" = "yes"; then
1062 if test "$TCL_VERSION" != "8.0" ; then
1063 GDBTK_CFLAGS="-fwritable-strings"
1064 fi
1065 fi
1066
1067 # Include some libraries that Tcl and Tk want.
b2a1bd4f 1068 TCL_LIBS='$(LIBGUI) $(ITCL) $(ITK) $(TK) $(TCL) $(X11_LDFLAGS) $(X11_LIBS)'
3fc11d3e
JM
1069 # Yes, the ordering seems wrong here. But it isn't.
1070 # TK_LIBS is the list of libraries that need to be linked
1071 # after Tcl/Tk. Note that this isn't put into LIBS. If it
1072 # were in LIBS then any link tests after this point would
1073 # try to include things like `$(LIBGUI)', which wouldn't work.
1074 GDBTKLIBS="${TCL_LIBS} ${TK_LIBS}"
4226a5a5
FN
1075
1076 CONFIG_OBS="${CONFIG_OBS} \$(SUBDIR_GDBTK_OBS)"
1077 CONFIG_DEPS="${CONFIG_DEPS} \$(SUBDIR_GDBTK_DEPS)"
1078 CONFIG_SRCS="${CONFIG_SRCS} \$(SUBDIR_GDBTK_SRCS)"
1079 CONFIG_INITS="${CONFIG_INITS} \$(SUBDIR_GDBTK_INITS)"
b3a90332 1080 CONFIG_ALL="${CONFIG_ALL} \$(SUBDIR_GDBTK_ALL)"
ce844ae2 1081 CONFIG_CLEAN="${CONFIG_CLEAN} \$(SUBDIR_GDBTK_CLEAN)"
e56ac5c3
AC
1082 CONFIG_INSTALL="${CONFIG_INSTALL} \$(SUBDIR_GDBTK_INSTALL)"
1083 CONFIG_UNINSTALL="${CONFIG_UNINSTALL} \$(SUBDIR_GDBTK_UNINSTALL)"
3fc11d3e
JM
1084
1085 if test x$gdb_cv_os_cygwin = xyes; then
1086 WIN32LIBS="${WIN32LIBS} -lshell32 -lgdi32 -lcomdlg32 -ladvapi32"
1087 WIN32LDAPP="-Wl,--subsystem,console"
1088 CONFIG_OBS="${CONFIG_OBS} gdbres.o"
1089 fi
1090 fi
1091 fi
ffc6a242 1092
ffc6a242 1093 configdirs="${configdirs} gdbtk"
3fc11d3e
JM
1094fi
1095
3fc11d3e
JM
1096AC_SUBST(X_CFLAGS)
1097AC_SUBST(X_LDFLAGS)
1098AC_SUBST(X_LIBS)
dd2504ab
JM
1099AC_SUBST(TCL_DEPS)
1100AC_SUBST(TK_DEPS)
3fc11d3e
JM
1101AC_SUBST(ITCLLIB)
1102AC_SUBST(ITCL_DEPS)
1103AC_SUBST(ITKLIB)
1104AC_SUBST(ITK_DEPS)
3fc11d3e
JM
1105AC_SUBST(GDBTKLIBS)
1106AC_SUBST(GDBTK_CFLAGS)
d1c3b63a 1107AC_SUBST(GDBTK_SRC_DIR)
8b93c638 1108
c906108c
SS
1109AC_PATH_X
1110
7a292a7a
SS
1111
1112# Unlike the sim directory, whether a simulator is linked is controlled by
1113# presence of a SIM= and a SIM_OBS= definition in the target '.mt' file.
1114# This code just checks for a few cases where we'd like to ignore those
1115# definitions, even when they're present in the '.mt' file. These cases
1116# are when --disable-sim is specified, or if the simulator directory is
6c5cfe5b 1117# not part of the source tree.
7a292a7a
SS
1118#
1119AC_ARG_ENABLE(sim,
1120[ --enable-sim Link gdb with simulator],
1121[echo "enable_sim = $enable_sim";
1122 echo "enableval = ${enableval}";
1123 case "${enableval}" in
1124 yes) ignore_sim=false ;;
1125 no) ignore_sim=true ;;
1126 *) ignore_sim=false ;;
1127 esac],
1128[ignore_sim=false])
1129
1130if test ! -d "${srcdir}/../sim"; then
1131 ignore_sim=true
1132fi
1133
1134if test "${ignore_sim}" = "true"; then
1135 IGNORE_SIM="SIM="
1136 IGNORE_SIM_OBS="SIM_OBS="
1137else
1138 IGNORE_SIM=""
1139 IGNORE_SIM_OBS=""
1140 AC_DEFINE(WITH_SIM)
1141fi
1142AC_SUBST(IGNORE_SIM)
1143AC_SUBST(IGNORE_SIM_OBS)
1144
c906108c
SS
1145AC_SUBST(ENABLE_CFLAGS)
1146
1147AC_SUBST(CONFIG_OBS)
66b965bb 1148AC_SUBST(CONFIG_LIB_OBS)
c906108c
SS
1149AC_SUBST(CONFIG_DEPS)
1150AC_SUBST(CONFIG_SRCS)
dfcd3bfb 1151AC_SUBST(CONFIG_INITS)
b3a90332
AC
1152AC_SUBST(CONFIG_ALL)
1153AC_SUBST(CONFIG_CLEAN)
e56ac5c3
AC
1154AC_SUBST(CONFIG_INSTALL)
1155AC_SUBST(CONFIG_UNINSTALL)
c906108c
SS
1156
1157# Begin stuff to support --enable-shared
1158AC_ARG_ENABLE(shared,
1159[ --enable-shared Use shared libraries],
1160[case "${enableval}" in
1161 yes) shared=true ;;
1162 no) shared=false ;;
1163 *) shared=true ;;
1164esac])dnl
1165
1166HLDFLAGS=
1167HLDENV=
1168# If we have shared libraries, try to set rpath reasonably.
1169if test "${shared}" = "true"; then
1170 case "${host}" in
1171 *-*-hpux*)
1172 HLDFLAGS='-Wl,+s,+b,$(libdir)'
1173 ;;
1174 *-*-irix5* | *-*-irix6*)
1175 HLDFLAGS='-Wl,-rpath,$(libdir)'
1176 ;;
1177 *-*-linux*aout*)
1178 ;;
d332c5ac 1179 *-*-linux* | *-pc-linux-gnu*)
c906108c
SS
1180 HLDFLAGS='-Wl,-rpath,$(libdir)'
1181 ;;
1182 *-*-solaris*)
1183 HLDFLAGS='-R $(libdir)'
1184 ;;
1185 *-*-sysv4*)
1186 HLDENV='if test -z "$${LD_RUN_PATH}"; then LD_RUN_PATH=$(libdir); else LD_RUN_PATH=$${LD_RUN_PATH}:$(libdir); fi; export LD_RUN_PATH;'
1187 ;;
1188 esac
1189fi
1190
1191# On SunOS, if the linker supports the -rpath option, use it to
1192# prevent ../bfd and ../opcodes from being included in the run time
1193# search path.
1194case "${host}" in
1195 *-*-sunos*)
1196 echo 'main () { }' > conftest.c
1197 ${CC} -o conftest -Wl,-rpath= conftest.c >/dev/null 2>conftest.t
1198 if grep 'unrecognized' conftest.t >/dev/null 2>&1; then
1199 :
1200 elif grep 'No such file' conftest.t >/dev/null 2>&1; then
1201 :
1202 elif grep 'do not mix' conftest.t >/dev/null 2>&1; then
1203 :
1204 elif grep 'some text already loaded' conftest.t >/dev/null 2>&1; then
1205 :
1206 elif test "${shared}" = "true"; then
1207 HLDFLAGS='-Wl,-rpath=$(libdir)'
1208 else
1209 HLDFLAGS='-Wl,-rpath='
1210 fi
1211 rm -f conftest.t conftest.c conftest
1212 ;;
1213esac
1214AC_SUBST(HLDFLAGS)
1215AC_SUBST(HLDENV)
1216# End stuff to support --enable-shared
1217
1218# target_subdir is used by the testsuite to find the target libraries.
1219target_subdir=
1220if test "${host}" != "${target}"; then
1221 target_subdir="${target_alias}/"
1222fi
1223AC_SUBST(target_subdir)
1224
1225frags=
1226host_makefile_frag=${srcdir}/config/${gdb_host_cpu}/${gdb_host}.mh
1227if test ! -f ${host_makefile_frag}; then
7fd60527
AC
1228 # When building a native debuger the .mh file containing things
1229 # like NATDEPFILES is needed. Cross debuggers don't need .mh
1230 # since it no longer contains anything useful.
1231 if test "${target}" = "${host}"; then
1232 AC_MSG_ERROR("*** Gdb does not support native target ${host}")
1233 else
1234 host_makefile_frag=/dev/null
1235 fi
c906108c
SS
1236fi
1237frags="$frags $host_makefile_frag"
1238
1239target_makefile_frag=${srcdir}/config/${gdb_target_cpu}/${gdb_target}.mt
1240if test ! -f ${target_makefile_frag}; then
1241AC_MSG_ERROR("*** Gdb does not support target ${target}")
1242fi
1243frags="$frags $target_makefile_frag"
1244
1245AC_SUBST_FILE(host_makefile_frag)
1246AC_SUBST_FILE(target_makefile_frag)
1247AC_SUBST(frags)
1248
1249changequote(,)dnl
1250hostfile=`sed -n '
1251s/XM_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
1252' ${host_makefile_frag}`
1253
1254targetfile=`sed -n '
1255s/TM_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
1256' ${target_makefile_frag}`
1257
6166d547
AC
1258GDB_MULTI_ARCH=`sed -n '
1259s/GDB_MULTI_ARCH[ ]*=[ ]*\([^ ]*\)[ ]*/\1/p
1260' ${target_makefile_frag}`
1261
c906108c 1262if test "${target}" = "${host}"; then
a85f51e7
DJ
1263# We pick this up from the host configuration file (.mh) because we
1264# do not have a native configuration Makefile fragment.
c906108c
SS
1265nativefile=`sed -n '
1266s/NAT_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
1267' ${host_makefile_frag}`
c906108c
SS
1268fi
1269changequote([,])
1270
6166d547
AC
1271# New targets should just set gdb_multi_arch=yes in configure.tgt.
1272# Old targets being converted can either do that or set GDB_MULTI_ARCH
1273# in the target specific makefile frag. Eventually gdb_multi_arch=yes
1274# will be the default.
1275if test x"${GDB_MULTI_ARCH}" = x ; then
1276 case "${gdb_multi_arch}" in
1277 yes ) GDB_MULTI_ARCH=GDB_MULTI_ARCH_PURE ;;
1278 no ) GDB_MULTI_ARCH=0 ;;
1279 0|1|2 ) GDB_MULTI_ARCH=${gdb_multi_arch} ;;
1280 esac
1281fi
1282if test x"${GDB_MULTI_ARCH}" != x ; then
1283 AC_DEFINE_UNQUOTED(GDB_MULTI_ARCH, ${GDB_MULTI_ARCH})
1284fi
6c5cfe5b 1285# Warn the user when they use an old practice
6166d547
AC
1286case "${GDB_MULTI_ARCH}" in
1287 "" ) ;;
1288 0 | GDB_MULTI_ARCH_PARTIAL | 1 | GDB_MULTI_ARCH_TM | 2 )
1289 AC_MSG_WARN("GDB: Target is not pure multi-arch") ;;
1290 GDB_MULTI_ARCH_PURE )
1291 if test x"${targetfile}" != x ; then
6c5cfe5b 1292 AC_MSG_WARN("GDB: Ignoring TM_FILE in ${target_makefile_frag}")
5a2402b8 1293 targetfile=""
6166d547
AC
1294 fi ;;
1295 *) AC_MSG_ERROR("GDB: Unknown GDB_MULTI_ARCH value ${GDB_MULTI_ARCH}");;
1296esac
1297
8dcde887
MK
1298# Enable multi-ice-gdb-server.
1299AC_ARG_ENABLE(multi-ice,
1300[ --enable-multi-ice build the multi-ice-gdb-server],
1301 [case $enableval in
1302 yes | no)
1303 ;;
1304 *) AC_MSG_ERROR([bad value $enableval for --enable-multi-ice]) ;;
1305 esac])
1306if test "x$enable_multi_ice" = xyes; then
1307 configdirs="$configdirs multi-ice"
96baa820
JM
1308fi
1309
8dcde887
MK
1310# We only build gdbserver automatically if host and target are the same.
1311if test "x$target" = "x$host"; then
1312 AC_MSG_CHECKING(whether gdbserver is supported on this host)
1313 if test "x$build_gdbserver" = xyes; then
1314 configdirs="$configdirs gdbserver"
1315 AC_MSG_RESULT(yes)
1316 else
1317 AC_MSG_RESULT(no)
1318 fi
a85f51e7
DJ
1319fi
1320
8dcde887
MK
1321AC_CONFIG_SUBDIRS($configdirs)
1322SUBDIRS=$subdirs
96baa820
JM
1323AC_SUBST(SUBDIRS)
1324
c906108c 1325# If hostfile (XM_FILE) and/or targetfile (TM_FILE) and/or nativefile
5a2402b8
AC
1326# (NAT_FILE) is not set in config/*/*.m[ht] files, we link to an empty
1327# version.
c906108c
SS
1328
1329files=
1330links=
5a2402b8 1331
c906108c 1332rm -f xm.h
5a2402b8 1333xm_h=""
c906108c 1334if test "${hostfile}" != ""; then
5a2402b8
AC
1335 xm_h=xm.h
1336 GDB_XM_FILE="config/${gdb_host_cpu}/${hostfile}"
1337 files="${files} ${GDB_XM_FILE}"
1338 links="${links} xm.h"
1339 AC_DEFINE_UNQUOTED(GDB_XM_FILE, ${GDB_XM_FILE})
c906108c 1340fi
5a2402b8
AC
1341AC_SUBST(xm_h)
1342
c906108c 1343rm -f tm.h
5a2402b8 1344tm_h=""
c906108c 1345if test "${targetfile}" != ""; then
5a2402b8
AC
1346 tm_h=tm.h
1347 GDB_TM_FILE="config/${gdb_target_cpu}/${targetfile}"
1348 files="${files} ${GDB_TM_FILE}"
1349 links="${links} tm.h"
1350 AC_DEFINE_UNQUOTED(GDB_TM_FILE, ${GDB_TM_FILE})
c906108c 1351fi
5a2402b8
AC
1352AC_SUBST(tm_h)
1353
c906108c 1354rm -f nm.h
5a2402b8 1355nm_h=""
c906108c 1356if test "${nativefile}" != ""; then
5a2402b8
AC
1357 nm_h=nm.h
1358 GDB_NM_FILE="config/${gdb_host_cpu}/${nativefile}"
1359 files="${files} ${GDB_NM_FILE}"
1360 links="${links} nm.h"
1361 AC_DEFINE_UNQUOTED(GDB_NM_FILE, ${GDB_NM_FILE})
c906108c 1362fi
5a2402b8
AC
1363AC_SUBST(nm_h)
1364
c906108c
SS
1365AC_LINK_FILES($files, $links)
1366
1367dnl Check for exe extension set on certain hosts (e.g. Win32)
1368AC_EXEEXT
1369
234b45d4
KB
1370dnl Detect the character set used by this host.
1371
1372dnl At the moment, we just assume it's ISO-8859-1 (which is a
1373dnl superset of ASCII containing the characters needed for French,
1374dnl German, Spanish, Italian, and possibly others), but if were
1375dnl *were* to support any host character sets other than ISO-8859-1,
1376dnl here's where we'd detect it.
1377AC_DEFINE(GDB_DEFAULT_HOST_CHARSET, "ISO-8859-1",
1378 [Define to be a string naming the default host character set.])
1379
1380AM_ICONV
1381
ed952ac5 1382AC_OUTPUT(Makefile .gdbinit:gdbinit.in,
c906108c
SS
1383[
1384dnl Autoconf doesn't provide a mechanism for modifying definitions
1385dnl provided by makefile fragments.
1386dnl
1387if test "${nativefile}" = ""; then
c4620205 1388 < Makefile \
e27da16d
JT
1389 sed -e '/^NATDEPFILES[[ ]]*=.*\\$/,/[[^\\]]$/s/^/# /' \
1390 -e '/^NATDEPFILES[[ ]]*=/s/^/# /' \
c4620205
JB
1391 | sed -e '/^\(NATDEPFILES[[ ]]*[[+]]=[[ ]]*\)/s//# \1/' \
1392 > Makefile.tem
c906108c
SS
1393mv -f Makefile.tem Makefile
1394fi
1395
1396changequote(,)dnl
1397sed -e '/^TM_FILE[ ]*=/s,^TM_FILE[ ]*=[ ]*,&config/'"${gdb_target_cpu}"'/,
1398/^XM_FILE[ ]*=/s,^XM_FILE[ ]*=[ ]*,&config/'"${gdb_host_cpu}"'/,
1399/^NAT_FILE[ ]*=/s,^NAT_FILE[ ]*=[ ]*,&config/'"${gdb_host_cpu}"'/,' <Makefile >Makefile.tmp
1400mv -f Makefile.tmp Makefile
1401changequote([,])dnl
1402
2acceee2 1403
c906108c
SS
1404case x$CONFIG_HEADERS in
1405xconfig.h:config.in)
1406echo > stamp-h ;;
1407esac
1408],
1409[
1410gdb_host_cpu=$gdb_host_cpu
1411gdb_target_cpu=$gdb_target_cpu
1412nativefile=$nativefile
1413])
1414
1415exit 0
This page took 0.625256 seconds and 4 git commands to generate.