Commit | Line | Data |
---|---|---|
d6e9fb05 | 1 | dnl Autoconf configure script for GDB server. |
6f0f660e | 2 | dnl Copyright (C) 2000, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. |
d6e9fb05 JK |
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 | |
6f0f660e EZ |
18 | dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 | dnl Boston, MA 02110-1301, USA. | |
d6e9fb05 JK |
20 | |
21 | dnl Process this file with autoconf to produce a configure script. | |
22 | ||
bec39cab AC |
23 | AC_PREREQ(2.59)dnl |
24 | ||
d6e9fb05 | 25 | AC_INIT(server.c) |
84563040 DJ |
26 | AC_CONFIG_HEADER(config.h:config.in) |
27 | ||
28 | AC_PROG_CC | |
d6e9fb05 JK |
29 | |
30 | AC_CANONICAL_SYSTEM | |
84563040 | 31 | |
d6e9fb05 | 32 | AC_PROG_INSTALL |
c906108c | 33 | |
dcdb98d2 DJ |
34 | AC_ARG_PROGRAM |
35 | ||
ee6e2b82 | 36 | AC_HEADER_STDC |
84563040 | 37 | |
0d62e5e8 | 38 | AC_CHECK_HEADERS(sgtty.h termio.h termios.h sys/reg.h string.h dnl |
94e10508 DJ |
39 | proc_service.h sys/procfs.h thread_db.h linux/elf.h dnl |
40 | stdlib.h unistd.h) | |
84563040 | 41 | |
e122f1f5 | 42 | AC_CHECK_DECLS(strerror) |
43d5792c | 43 | |
ccbd4912 MK |
44 | AC_CHECK_TYPES(socklen_t, [], [], |
45 | [#include <sys/types.h> | |
46 | #include <sys/socket.h> | |
47 | ]) | |
7ea81414 | 48 | . ${srcdir}/configure.srv |
c906108c | 49 | |
58caa3dc | 50 | if test "${srv_linux_usrregs}" = "yes"; then |
f450004a DJ |
51 | AC_DEFINE(HAVE_LINUX_USRREGS, 1, |
52 | [Define if the target supports PTRACE_PEEKUSR for register ] | |
53 | [access.]) | |
58caa3dc DJ |
54 | fi |
55 | ||
56 | if test "${srv_linux_regsets}" = "yes"; then | |
e9d25b98 DJ |
57 | AC_DEFINE(HAVE_LINUX_REGSETS, 1, |
58 | [Define if the target supports register sets.]) | |
59 | ||
58caa3dc DJ |
60 | AC_MSG_CHECKING(for PTRACE_GETREGS) |
61 | AC_CACHE_VAL(gdbsrv_cv_have_ptrace_getregs, | |
62 | [AC_TRY_COMPILE([#include <sys/ptrace.h>], | |
63 | [PTRACE_GETREGS;], | |
64 | [gdbsrv_cv_have_ptrace_getregs=yes], | |
65 | [gdbsrv_cv_have_ptrace_getregs=no])]) | |
66 | AC_MSG_RESULT($gdbsrv_cv_have_ptrace_getregs) | |
67 | if test "${gdbsrv_cv_have_ptrace_getregs}" = "yes"; then | |
e9d25b98 | 68 | AC_DEFINE(HAVE_PTRACE_GETREGS, 1, |
f450004a DJ |
69 | [Define if the target supports PTRACE_GETREGS for register ] |
70 | [access.]) | |
58caa3dc DJ |
71 | fi |
72 | ||
73 | AC_MSG_CHECKING(for PTRACE_GETFPXREGS) | |
74 | AC_CACHE_VAL(gdbsrv_cv_have_ptrace_getfpxregs, | |
75 | [AC_TRY_COMPILE([#include <sys/ptrace.h>], | |
76 | [PTRACE_GETFPXREGS;], | |
77 | [gdbsrv_cv_have_ptrace_getfpxregs=yes], | |
78 | [gdbsrv_cv_have_ptrace_getfpxregs=no])]) | |
79 | AC_MSG_RESULT($gdbsrv_cv_have_ptrace_getfpxregs) | |
80 | if test "${gdbsrv_cv_have_ptrace_getfpxregs}" = "yes"; then | |
f450004a DJ |
81 | AC_DEFINE(HAVE_PTRACE_GETFPXREGS, 1, |
82 | [Define if the target supports PTRACE_GETFPXREGS for extended ] | |
83 | [register access.]) | |
58caa3dc DJ |
84 | fi |
85 | fi | |
86 | ||
0d62e5e8 DJ |
87 | if test "$ac_cv_header_sys_procfs_h" = yes; then |
88 | BFD_HAVE_SYS_PROCFS_TYPE(lwpid_t) | |
89 | BFD_HAVE_SYS_PROCFS_TYPE(psaddr_t) | |
90 | BFD_HAVE_SYS_PROCFS_TYPE(prgregset_t) | |
91 | BFD_HAVE_SYS_PROCFS_TYPE(prfpregset_t) | |
92 | ||
93 | dnl Check for broken prfpregset_t type | |
94 | ||
95 | dnl For Linux/i386, glibc 2.1.3 was released with a bogus | |
96 | dnl prfpregset_t type (it's a typedef for the pointer to a struct | |
97 | dnl instead of the struct itself). We detect this here, and work | |
98 | dnl around it in gdb_proc_service.h. | |
99 | ||
100 | if test $bfd_cv_have_sys_procfs_type_prfpregset_t = yes; then | |
101 | AC_MSG_CHECKING(whether prfpregset_t type is broken) | |
102 | AC_CACHE_VAL(gdb_cv_prfpregset_t_broken, | |
103 | [AC_TRY_RUN([#include <sys/procfs.h> | |
104 | int main () | |
105 | { | |
106 | if (sizeof (prfpregset_t) == sizeof (void *)) | |
107 | return 1; | |
108 | return 0; | |
109 | }], | |
110 | gdb_cv_prfpregset_t_broken=no, | |
111 | gdb_cv_prfpregset_t_broken=yes, | |
112 | gdb_cv_prfpregset_t_broken=yes)]) | |
113 | AC_MSG_RESULT($gdb_cv_prfpregset_t_broken) | |
114 | if test $gdb_cv_prfpregset_t_broken = yes; then | |
f450004a DJ |
115 | AC_DEFINE(PRFPREGSET_T_BROKEN, 1, |
116 | [Define if the prfpregset_t type is broken.]) | |
0d62e5e8 DJ |
117 | fi |
118 | fi | |
119 | ||
120 | BFD_HAVE_SYS_PROCFS_TYPE(elf_fpregset_t) | |
121 | fi | |
122 | ||
123 | srv_thread_depfiles= | |
124 | srv_libs= | |
125 | USE_THREAD_DB= | |
126 | ||
127 | if test "$srv_linux_thread_db" = "yes"; then | |
128 | SRV_CHECK_THREAD_DB | |
129 | if test "$srv_cv_thread_db" = no; then | |
130 | AC_WARN([Could not find libthread_db.]) | |
131 | AC_WARN([Disabling thread support in gdbserver.]) | |
132 | srv_linux_thread_db=no | |
133 | else | |
134 | srv_libs="$srv_cv_thread_db" | |
135 | fi | |
f6de3c42 DJ |
136 | old_LDFLAGS="$LDFLAGS" |
137 | LDFLAGS="$LDFLAGS -rdynamic" | |
138 | AC_TRY_LINK([], [], [RDYNAMIC=-rdynamic], [RDYNAMIC=]) | |
139 | AC_SUBST(RDYNAMIC) | |
140 | LDFLAGS="$old_LDFLAGS" | |
0d62e5e8 DJ |
141 | fi |
142 | ||
143 | if test "$srv_linux_thread_db" = "yes"; then | |
144 | srv_thread_depfiles="thread-db.o proc-service.o" | |
145 | USE_THREAD_DB="-DUSE_THREAD_DB" | |
3db0444b DJ |
146 | AC_CACHE_CHECK([for TD_VERSION], gdbsrv_cv_have_td_version, |
147 | [AC_TRY_COMPILE([#include <thread_db.h>], [TD_VERSION;], | |
148 | [gdbsrv_cv_have_td_version=yes], | |
149 | [gdbsrv_cv_have_td_version=no])]) | |
150 | if test $gdbsrv_cv_have_td_version = yes; then | |
151 | AC_DEFINE(HAVE_TD_VERSION, 1, [Define if TD_VERSION is available.]) | |
152 | fi | |
0d62e5e8 DJ |
153 | fi |
154 | ||
155 | GDBSERVER_DEPFILES="$srv_regobj $srv_tgtobj $srv_thread_depfiles" | |
156 | GDBSERVER_LIBS="$srv_libs" | |
c906108c | 157 | |
7ea81414 | 158 | AC_SUBST(GDBSERVER_DEPFILES) |
0d62e5e8 DJ |
159 | AC_SUBST(GDBSERVER_LIBS) |
160 | AC_SUBST(USE_THREAD_DB) | |
c906108c | 161 | |
c3a3ccc7 DJ |
162 | AC_OUTPUT(Makefile, |
163 | [case x$CONFIG_HEADERS in | |
164 | xconfig.h:config.in) | |
165 | echo > stamp-h ;; | |
166 | esac | |
167 | ]) |