* gdb.texinfo (GDB/MI Output Records):
[deliverable/binutils-gdb.git] / gdb / gdbserver / configure.ac
CommitLineData
d6e9fb05 1dnl Autoconf configure script for GDB server.
e28b3332 2dnl Copyright (C) 2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008
0050a760 3dnl Free Software Foundation, Inc.
d6e9fb05
JK
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
5a0e3bd0 9dnl the Free Software Foundation; either version 3 of the License, or
d6e9fb05
JK
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
5a0e3bd0 18dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
d6e9fb05
JK
19
20dnl Process this file with autoconf to produce a configure script.
21
bec39cab
AC
22AC_PREREQ(2.59)dnl
23
d6e9fb05 24AC_INIT(server.c)
84563040 25AC_CONFIG_HEADER(config.h:config.in)
e28b3332 26AC_CONFIG_LIBOBJ_DIR(../gnulib)
84563040
DJ
27
28AC_PROG_CC
fd462a61 29AC_GNU_SOURCE
d6e9fb05
JK
30
31AC_CANONICAL_SYSTEM
84563040 32
d6e9fb05 33AC_PROG_INSTALL
c906108c 34
dcdb98d2
DJ
35AC_ARG_PROGRAM
36
ee6e2b82 37AC_HEADER_STDC
84563040 38
0d62e5e8 39AC_CHECK_HEADERS(sgtty.h termio.h termios.h sys/reg.h string.h dnl
94e10508 40 proc_service.h sys/procfs.h thread_db.h linux/elf.h dnl
b80864fb 41 stdlib.h unistd.h dnl
68070c10 42 errno.h fcntl.h signal.h sys/file.h malloc.h dnl
61ff6e04 43 sys/ioctl.h netinet/in.h sys/socket.h netdb.h dnl
b80864fb 44 netinet/tcp.h arpa/inet.h sys/wait.h)
4e799345 45AC_CHECK_FUNCS(pread pwrite pread64)
e28b3332 46AC_REPLACE_FUNCS(memmem)
84563040 47
68070c10
PA
48have_errno=no
49AC_MSG_CHECKING(for errno)
50AC_TRY_LINK([
51#if HAVE_ERRNO_H
52#include <errno.h>
53#endif], [static int x; x = errno;],
54 [AC_MSG_RESULT(yes - in errno.h); AC_DEFINE(HAVE_ERRNO, 1, [Define if errno is available]) have_errno=yes])
55if test $have_errno = no; then
56AC_TRY_LINK([
57#if HAVE_ERRNO_H
58#include <errno.h>
59#endif], [extern int errno; static int x; x = errno;],
60 [AC_MSG_RESULT(yes - must define); AC_DEFINE(HAVE_ERRNO, 1, [Define if errno is available]) AC_DEFINE(MUST_DEFINE_ERRNO, 1, [Checking if errno must be defined])],
61 [AC_MSG_RESULT(no)])
62fi
63
64AC_CHECK_DECLS([strerror, perror])
43d5792c 65
ccbd4912
MK
66AC_CHECK_TYPES(socklen_t, [], [],
67[#include <sys/types.h>
68#include <sys/socket.h>
69])
fb1e4ffc 70
7ea81414 71. ${srcdir}/configure.srv
c906108c 72
68070c10
PA
73if test "${srv_mingwce}" = "yes"; then
74 LIBS="$LIBS -lws2"
75elif test "${srv_mingw}" = "yes"; then
b80864fb 76 LIBS="$LIBS -lwsock32"
68070c10
PA
77fi
78
79if test "${srv_mingw}" = "yes"; then
b80864fb
DJ
80 AC_DEFINE(USE_WIN32API, 1,
81 [Define if we should use the Windows API, instead of the
82 POSIX API. On Windows, we use the Windows API when
83 building for MinGW, but the POSIX API when building
84 for Cygwin.])
85fi
86
58caa3dc 87if test "${srv_linux_usrregs}" = "yes"; then
f450004a
DJ
88 AC_DEFINE(HAVE_LINUX_USRREGS, 1,
89 [Define if the target supports PTRACE_PEEKUSR for register ]
90 [access.])
58caa3dc
DJ
91fi
92
93if test "${srv_linux_regsets}" = "yes"; then
e9d25b98
DJ
94 AC_DEFINE(HAVE_LINUX_REGSETS, 1,
95 [Define if the target supports register sets.])
96
58caa3dc
DJ
97 AC_MSG_CHECKING(for PTRACE_GETREGS)
98 AC_CACHE_VAL(gdbsrv_cv_have_ptrace_getregs,
99 [AC_TRY_COMPILE([#include <sys/ptrace.h>],
100 [PTRACE_GETREGS;],
101 [gdbsrv_cv_have_ptrace_getregs=yes],
102 [gdbsrv_cv_have_ptrace_getregs=no])])
103 AC_MSG_RESULT($gdbsrv_cv_have_ptrace_getregs)
104 if test "${gdbsrv_cv_have_ptrace_getregs}" = "yes"; then
e9d25b98 105 AC_DEFINE(HAVE_PTRACE_GETREGS, 1,
f450004a
DJ
106 [Define if the target supports PTRACE_GETREGS for register ]
107 [access.])
58caa3dc
DJ
108 fi
109
110 AC_MSG_CHECKING(for PTRACE_GETFPXREGS)
111 AC_CACHE_VAL(gdbsrv_cv_have_ptrace_getfpxregs,
112 [AC_TRY_COMPILE([#include <sys/ptrace.h>],
113 [PTRACE_GETFPXREGS;],
114 [gdbsrv_cv_have_ptrace_getfpxregs=yes],
115 [gdbsrv_cv_have_ptrace_getfpxregs=no])])
116 AC_MSG_RESULT($gdbsrv_cv_have_ptrace_getfpxregs)
117 if test "${gdbsrv_cv_have_ptrace_getfpxregs}" = "yes"; then
f450004a
DJ
118 AC_DEFINE(HAVE_PTRACE_GETFPXREGS, 1,
119 [Define if the target supports PTRACE_GETFPXREGS for extended ]
120 [register access.])
58caa3dc
DJ
121 fi
122fi
123
0d62e5e8
DJ
124if test "$ac_cv_header_sys_procfs_h" = yes; then
125 BFD_HAVE_SYS_PROCFS_TYPE(lwpid_t)
126 BFD_HAVE_SYS_PROCFS_TYPE(psaddr_t)
127 BFD_HAVE_SYS_PROCFS_TYPE(prgregset_t)
0d62e5e8
DJ
128 BFD_HAVE_SYS_PROCFS_TYPE(elf_fpregset_t)
129fi
130
131srv_thread_depfiles=
132srv_libs=
133USE_THREAD_DB=
134
135if test "$srv_linux_thread_db" = "yes"; then
136 SRV_CHECK_THREAD_DB
137 if test "$srv_cv_thread_db" = no; then
138 AC_WARN([Could not find libthread_db.])
139 AC_WARN([Disabling thread support in gdbserver.])
140 srv_linux_thread_db=no
141 else
142 srv_libs="$srv_cv_thread_db"
dae5f5cf 143 SRV_CHECK_TLS_GET_ADDR
0d62e5e8 144 fi
f6de3c42
DJ
145 old_LDFLAGS="$LDFLAGS"
146 LDFLAGS="$LDFLAGS -rdynamic"
147 AC_TRY_LINK([], [], [RDYNAMIC=-rdynamic], [RDYNAMIC=])
148 AC_SUBST(RDYNAMIC)
149 LDFLAGS="$old_LDFLAGS"
0d62e5e8
DJ
150fi
151
152if test "$srv_linux_thread_db" = "yes"; then
153 srv_thread_depfiles="thread-db.o proc-service.o"
154 USE_THREAD_DB="-DUSE_THREAD_DB"
3db0444b
DJ
155 AC_CACHE_CHECK([for TD_VERSION], gdbsrv_cv_have_td_version,
156 [AC_TRY_COMPILE([#include <thread_db.h>], [TD_VERSION;],
157 [gdbsrv_cv_have_td_version=yes],
158 [gdbsrv_cv_have_td_version=no])])
159 if test $gdbsrv_cv_have_td_version = yes; then
160 AC_DEFINE(HAVE_TD_VERSION, 1, [Define if TD_VERSION is available.])
161 fi
dae5f5cf 162
cb7283db 163 if test "$srv_cv_tls_get_addr" = yes; then
dae5f5cf
DJ
164 AC_DEFINE(HAVE_TD_THR_TLS_GET_ADDR, 1, [Define if td_thr_tls_get_addr is available.])
165 fi
0d62e5e8
DJ
166fi
167
9b4b61c8 168if test "$srv_xmlfiles" != ""; then
fb1e4ffc
DJ
169 srv_xmlbuiltin="xml-builtin.o"
170 AC_DEFINE(USE_XML, 1, [Define if an XML target description is available.])
171
172 tmp_xmlfiles=$srv_xmlfiles
9b4b61c8 173 srv_xmlfiles=""
fb1e4ffc
DJ
174 for f in $tmp_xmlfiles; do
175 srv_xmlfiles="$srv_xmlfiles \$(XML_DIR)/$f"
176 done
177fi
178
59a016f0 179GDBSERVER_DEPFILES="$srv_regobj $srv_tgtobj $srv_hostio_err_objs $srv_thread_depfiles"
0d62e5e8 180GDBSERVER_LIBS="$srv_libs"
c906108c 181
7ea81414 182AC_SUBST(GDBSERVER_DEPFILES)
0d62e5e8
DJ
183AC_SUBST(GDBSERVER_LIBS)
184AC_SUBST(USE_THREAD_DB)
fb1e4ffc
DJ
185AC_SUBST(srv_xmlbuiltin)
186AC_SUBST(srv_xmlfiles)
c906108c 187
c3a3ccc7
DJ
188AC_OUTPUT(Makefile,
189[case x$CONFIG_HEADERS in
190xconfig.h:config.in)
191echo > stamp-h ;;
192esac
193])
This page took 0.575116 seconds and 4 git commands to generate.