* configure.ac: Define HAVE_LINUX_REGSETS even if PTRACE_GETREGS
[deliverable/binutils-gdb.git] / gdb / gdbserver / configure.ac
1 dnl Autoconf configure script for GDB server.
2 dnl Copyright 2000, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
3 dnl
4 dnl This file is part of GDB.
5 dnl
6 dnl This program is free software; you can redistribute it and/or modify
7 dnl it under the terms of the GNU General Public License as published by
8 dnl the Free Software Foundation; either version 2 of the License, or
9 dnl (at your option) any later version.
10 dnl
11 dnl This program is distributed in the hope that it will be useful,
12 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
13 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 dnl GNU General Public License for more details.
15 dnl
16 dnl You should have received a copy of the GNU General Public License
17 dnl along with this program; if not, write to the Free Software
18 dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
20 dnl Process this file with autoconf to produce a configure script.
21
22 AC_PREREQ(2.59)dnl
23
24 AC_INIT(server.c)
25 AC_CONFIG_HEADER(config.h:config.in)
26
27 AC_PROG_CC
28
29 AC_CANONICAL_SYSTEM
30
31 AC_PROG_INSTALL
32
33 AC_ARG_PROGRAM
34
35 AC_HEADER_STDC
36
37 AC_CHECK_HEADERS(sgtty.h termio.h termios.h sys/reg.h string.h dnl
38 proc_service.h sys/procfs.h thread_db.h linux/elf.h dnl
39 stdlib.h unistd.h)
40
41 AC_CHECK_DECLS(strerror)
42
43 AC_CHECK_TYPES(socklen_t, [], [],
44 [#include <sys/types.h>
45 #include <sys/socket.h>
46 ])
47 . ${srcdir}/configure.srv
48
49 if test "${srv_linux_usrregs}" = "yes"; then
50 AC_DEFINE(HAVE_LINUX_USRREGS, 1,
51 [Define if the target supports PTRACE_PEEKUSR for register ]
52 [access.])
53 fi
54
55 if test "${srv_linux_regsets}" = "yes"; then
56 AC_DEFINE(HAVE_LINUX_REGSETS, 1,
57 [Define if the target supports register sets.])
58
59 AC_MSG_CHECKING(for PTRACE_GETREGS)
60 AC_CACHE_VAL(gdbsrv_cv_have_ptrace_getregs,
61 [AC_TRY_COMPILE([#include <sys/ptrace.h>],
62 [PTRACE_GETREGS;],
63 [gdbsrv_cv_have_ptrace_getregs=yes],
64 [gdbsrv_cv_have_ptrace_getregs=no])])
65 AC_MSG_RESULT($gdbsrv_cv_have_ptrace_getregs)
66 if test "${gdbsrv_cv_have_ptrace_getregs}" = "yes"; then
67 AC_DEFINE(HAVE_PTRACE_GETREGS, 1,
68 [Define if the target supports PTRACE_GETREGS for register ]
69 [access.])
70 fi
71
72 AC_MSG_CHECKING(for PTRACE_GETFPXREGS)
73 AC_CACHE_VAL(gdbsrv_cv_have_ptrace_getfpxregs,
74 [AC_TRY_COMPILE([#include <sys/ptrace.h>],
75 [PTRACE_GETFPXREGS;],
76 [gdbsrv_cv_have_ptrace_getfpxregs=yes],
77 [gdbsrv_cv_have_ptrace_getfpxregs=no])])
78 AC_MSG_RESULT($gdbsrv_cv_have_ptrace_getfpxregs)
79 if test "${gdbsrv_cv_have_ptrace_getfpxregs}" = "yes"; then
80 AC_DEFINE(HAVE_PTRACE_GETFPXREGS, 1,
81 [Define if the target supports PTRACE_GETFPXREGS for extended ]
82 [register access.])
83 fi
84 fi
85
86 if test "$ac_cv_header_sys_procfs_h" = yes; then
87 BFD_HAVE_SYS_PROCFS_TYPE(lwpid_t)
88 BFD_HAVE_SYS_PROCFS_TYPE(psaddr_t)
89 BFD_HAVE_SYS_PROCFS_TYPE(prgregset_t)
90 BFD_HAVE_SYS_PROCFS_TYPE(prfpregset_t)
91
92 dnl Check for broken prfpregset_t type
93
94 dnl For Linux/i386, glibc 2.1.3 was released with a bogus
95 dnl prfpregset_t type (it's a typedef for the pointer to a struct
96 dnl instead of the struct itself). We detect this here, and work
97 dnl around it in gdb_proc_service.h.
98
99 if test $bfd_cv_have_sys_procfs_type_prfpregset_t = yes; then
100 AC_MSG_CHECKING(whether prfpregset_t type is broken)
101 AC_CACHE_VAL(gdb_cv_prfpregset_t_broken,
102 [AC_TRY_RUN([#include <sys/procfs.h>
103 int main ()
104 {
105 if (sizeof (prfpregset_t) == sizeof (void *))
106 return 1;
107 return 0;
108 }],
109 gdb_cv_prfpregset_t_broken=no,
110 gdb_cv_prfpregset_t_broken=yes,
111 gdb_cv_prfpregset_t_broken=yes)])
112 AC_MSG_RESULT($gdb_cv_prfpregset_t_broken)
113 if test $gdb_cv_prfpregset_t_broken = yes; then
114 AC_DEFINE(PRFPREGSET_T_BROKEN, 1,
115 [Define if the prfpregset_t type is broken.])
116 fi
117 fi
118
119 BFD_HAVE_SYS_PROCFS_TYPE(elf_fpregset_t)
120 fi
121
122 srv_thread_depfiles=
123 srv_libs=
124 USE_THREAD_DB=
125
126 if test "$srv_linux_thread_db" = "yes"; then
127 SRV_CHECK_THREAD_DB
128 if test "$srv_cv_thread_db" = no; then
129 AC_WARN([Could not find libthread_db.])
130 AC_WARN([Disabling thread support in gdbserver.])
131 srv_linux_thread_db=no
132 else
133 srv_libs="$srv_cv_thread_db"
134 fi
135 old_LDFLAGS="$LDFLAGS"
136 LDFLAGS="$LDFLAGS -rdynamic"
137 AC_TRY_LINK([], [], [RDYNAMIC=-rdynamic], [RDYNAMIC=])
138 AC_SUBST(RDYNAMIC)
139 LDFLAGS="$old_LDFLAGS"
140 fi
141
142 if test "$srv_linux_thread_db" = "yes"; then
143 srv_thread_depfiles="thread-db.o proc-service.o"
144 USE_THREAD_DB="-DUSE_THREAD_DB"
145 fi
146
147 GDBSERVER_DEPFILES="$srv_regobj $srv_tgtobj $srv_thread_depfiles"
148 GDBSERVER_LIBS="$srv_libs"
149
150 AC_SUBST(GDBSERVER_DEPFILES)
151 AC_SUBST(GDBSERVER_LIBS)
152 AC_SUBST(USE_THREAD_DB)
153
154 AC_OUTPUT(Makefile,
155 [case x$CONFIG_HEADERS in
156 xconfig.h:config.in)
157 echo > stamp-h ;;
158 esac
159 ])
This page took 0.033813 seconds and 4 git commands to generate.