1 dnl Autoconf configure script for GDB server.
2 dnl Copyright (C) 2000, 2002, 2003, 2004, 2005, 2006
3 dnl Free Software Foundation, Inc.
5 dnl This file is part of GDB.
7 dnl This program is free software; you can redistribute it and/or modify
8 dnl it under the terms of the GNU General Public License as published by
9 dnl the Free Software Foundation; either version 3 of the License, or
10 dnl (at your option) any later version.
12 dnl This program is distributed in the hope that it will be useful,
13 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
14 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 dnl GNU General Public License for more details.
17 dnl You should have received a copy of the GNU General Public License
18 dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
20 dnl Process this file with autoconf to produce a configure script.
25 AC_CONFIG_HEADER(config.h:config.in)
38 AC_CHECK_HEADERS(sgtty.h termio.h termios.h sys/reg.h string.h dnl
39 proc_service.h sys/procfs.h thread_db.h linux/elf.h dnl
41 errno.h fcntl.h signal.h sys/file.h malloc.h dnl
42 sys/ioctl.h netinet/in.h sys/socket.h netdb.h dnl
43 netinet/tcp.h arpa/inet.h sys/wait.h)
44 AC_CHECK_FUNCS(pread pwrite pread64)
47 AC_MSG_CHECKING(for errno)
51 #endif], [static int x; x = errno;],
52 [AC_MSG_RESULT(yes - in errno.h); AC_DEFINE(HAVE_ERRNO, 1, [Define if errno is available]) have_errno=yes])
53 if test $have_errno = no; then
57 #endif], [extern int errno; static int x; x = errno;],
58 [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])],
62 AC_CHECK_DECLS([strerror, perror])
64 AC_CHECK_TYPES(socklen_t, [], [],
65 [#include <sys/types.h>
66 #include <sys/socket.h>
69 . ${srcdir}/configure.srv
71 if test "${srv_mingwce}" = "yes"; then
73 elif test "${srv_mingw}" = "yes"; then
74 LIBS="$LIBS -lwsock32"
77 if test "${srv_mingw}" = "yes"; then
78 AC_DEFINE(USE_WIN32API, 1,
79 [Define if we should use the Windows API, instead of the
80 POSIX API. On Windows, we use the Windows API when
81 building for MinGW, but the POSIX API when building
85 if test "${srv_linux_usrregs}" = "yes"; then
86 AC_DEFINE(HAVE_LINUX_USRREGS, 1,
87 [Define if the target supports PTRACE_PEEKUSR for register ]
91 if test "${srv_linux_regsets}" = "yes"; then
92 AC_DEFINE(HAVE_LINUX_REGSETS, 1,
93 [Define if the target supports register sets.])
95 AC_MSG_CHECKING(for PTRACE_GETREGS)
96 AC_CACHE_VAL(gdbsrv_cv_have_ptrace_getregs,
97 [AC_TRY_COMPILE([#include <sys/ptrace.h>],
99 [gdbsrv_cv_have_ptrace_getregs=yes],
100 [gdbsrv_cv_have_ptrace_getregs=no])])
101 AC_MSG_RESULT($gdbsrv_cv_have_ptrace_getregs)
102 if test "${gdbsrv_cv_have_ptrace_getregs}" = "yes"; then
103 AC_DEFINE(HAVE_PTRACE_GETREGS, 1,
104 [Define if the target supports PTRACE_GETREGS for register ]
108 AC_MSG_CHECKING(for PTRACE_GETFPXREGS)
109 AC_CACHE_VAL(gdbsrv_cv_have_ptrace_getfpxregs,
110 [AC_TRY_COMPILE([#include <sys/ptrace.h>],
111 [PTRACE_GETFPXREGS;],
112 [gdbsrv_cv_have_ptrace_getfpxregs=yes],
113 [gdbsrv_cv_have_ptrace_getfpxregs=no])])
114 AC_MSG_RESULT($gdbsrv_cv_have_ptrace_getfpxregs)
115 if test "${gdbsrv_cv_have_ptrace_getfpxregs}" = "yes"; then
116 AC_DEFINE(HAVE_PTRACE_GETFPXREGS, 1,
117 [Define if the target supports PTRACE_GETFPXREGS for extended ]
122 if test "$ac_cv_header_sys_procfs_h" = yes; then
123 BFD_HAVE_SYS_PROCFS_TYPE(lwpid_t)
124 BFD_HAVE_SYS_PROCFS_TYPE(psaddr_t)
125 BFD_HAVE_SYS_PROCFS_TYPE(prgregset_t)
126 BFD_HAVE_SYS_PROCFS_TYPE(elf_fpregset_t)
133 if test "$srv_linux_thread_db" = "yes"; then
135 if test "$srv_cv_thread_db" = no; then
136 AC_WARN([Could not find libthread_db.])
137 AC_WARN([Disabling thread support in gdbserver.])
138 srv_linux_thread_db=no
140 srv_libs="$srv_cv_thread_db"
141 SRV_CHECK_TLS_GET_ADDR
143 old_LDFLAGS="$LDFLAGS"
144 LDFLAGS="$LDFLAGS -rdynamic"
145 AC_TRY_LINK([], [], [RDYNAMIC=-rdynamic], [RDYNAMIC=])
147 LDFLAGS="$old_LDFLAGS"
150 if test "$srv_linux_thread_db" = "yes"; then
151 srv_thread_depfiles="thread-db.o proc-service.o"
152 USE_THREAD_DB="-DUSE_THREAD_DB"
153 AC_CACHE_CHECK([for TD_VERSION], gdbsrv_cv_have_td_version,
154 [AC_TRY_COMPILE([#include <thread_db.h>], [TD_VERSION;],
155 [gdbsrv_cv_have_td_version=yes],
156 [gdbsrv_cv_have_td_version=no])])
157 if test $gdbsrv_cv_have_td_version = yes; then
158 AC_DEFINE(HAVE_TD_VERSION, 1, [Define if TD_VERSION is available.])
161 if test "$srv_cv_tls_get_addr" = yes; then
162 AC_DEFINE(HAVE_TD_THR_TLS_GET_ADDR, 1, [Define if td_thr_tls_get_addr is available.])
166 if test "$srv_xmlfiles" != ""; then
167 srv_xmlbuiltin="xml-builtin.o"
168 AC_DEFINE(USE_XML, 1, [Define if an XML target description is available.])
170 tmp_xmlfiles=$srv_xmlfiles
172 for f in $tmp_xmlfiles; do
173 srv_xmlfiles="$srv_xmlfiles \$(XML_DIR)/$f"
177 GDBSERVER_DEPFILES="$srv_regobj $srv_tgtobj $srv_hostio_err_objs $srv_thread_depfiles"
178 GDBSERVER_LIBS="$srv_libs"
180 AC_SUBST(GDBSERVER_DEPFILES)
181 AC_SUBST(GDBSERVER_LIBS)
182 AC_SUBST(USE_THREAD_DB)
183 AC_SUBST(srv_xmlbuiltin)
184 AC_SUBST(srv_xmlfiles)
187 [case x$CONFIG_HEADERS in