gdb/
[deliverable/binutils-gdb.git] / gdb / gdbserver / configure.ac
1 dnl Autoconf configure script for GDB server.
2 dnl Copyright (C) 2000, 2002, 2003, 2004, 2005, 2006
3 dnl Free Software Foundation, Inc.
4 dnl
5 dnl This file is part of GDB.
6 dnl
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 2 of the License, or
10 dnl (at your option) any later version.
11 dnl
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.
16 dnl
17 dnl You should have received a copy of the GNU General Public License
18 dnl along with this program; if not, write to the Free Software
19 dnl Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 dnl Boston, MA 02110-1301, USA.
21
22 dnl Process this file with autoconf to produce a configure script.
23
24 AC_PREREQ(2.59)dnl
25
26 AC_INIT(server.c)
27 AC_CONFIG_HEADER(config.h:config.in)
28
29 AC_PROG_CC
30
31 AC_CANONICAL_SYSTEM
32
33 AC_PROG_INSTALL
34
35 AC_ARG_PROGRAM
36
37 AC_HEADER_STDC
38
39 AC_CHECK_HEADERS(sgtty.h termio.h termios.h sys/reg.h string.h dnl
40 proc_service.h sys/procfs.h thread_db.h linux/elf.h dnl
41 stdlib.h unistd.h dnl
42 terminal.h sys/ioctl.h netinet/in.h sys/socket.h netdb.h dnl
43 netinet/tcp.h arpa/inet.h sys/wait.h)
44
45 AC_CHECK_DECLS(strerror)
46
47 AC_CHECK_TYPES(socklen_t, [], [],
48 [#include <sys/types.h>
49 #include <sys/socket.h>
50 ])
51 . ${srcdir}/configure.srv
52
53 if test "${srv_mingw}" = "yes"; then
54 LIBS="$LIBS -lwsock32"
55 AC_DEFINE(USE_WIN32API, 1,
56 [Define if we should use the Windows API, instead of the
57 POSIX API. On Windows, we use the Windows API when
58 building for MinGW, but the POSIX API when building
59 for Cygwin.])
60 fi
61
62 if test "${srv_linux_usrregs}" = "yes"; then
63 AC_DEFINE(HAVE_LINUX_USRREGS, 1,
64 [Define if the target supports PTRACE_PEEKUSR for register ]
65 [access.])
66 fi
67
68 if test "${srv_linux_regsets}" = "yes"; then
69 AC_DEFINE(HAVE_LINUX_REGSETS, 1,
70 [Define if the target supports register sets.])
71
72 AC_MSG_CHECKING(for PTRACE_GETREGS)
73 AC_CACHE_VAL(gdbsrv_cv_have_ptrace_getregs,
74 [AC_TRY_COMPILE([#include <sys/ptrace.h>],
75 [PTRACE_GETREGS;],
76 [gdbsrv_cv_have_ptrace_getregs=yes],
77 [gdbsrv_cv_have_ptrace_getregs=no])])
78 AC_MSG_RESULT($gdbsrv_cv_have_ptrace_getregs)
79 if test "${gdbsrv_cv_have_ptrace_getregs}" = "yes"; then
80 AC_DEFINE(HAVE_PTRACE_GETREGS, 1,
81 [Define if the target supports PTRACE_GETREGS for register ]
82 [access.])
83 fi
84
85 AC_MSG_CHECKING(for PTRACE_GETFPXREGS)
86 AC_CACHE_VAL(gdbsrv_cv_have_ptrace_getfpxregs,
87 [AC_TRY_COMPILE([#include <sys/ptrace.h>],
88 [PTRACE_GETFPXREGS;],
89 [gdbsrv_cv_have_ptrace_getfpxregs=yes],
90 [gdbsrv_cv_have_ptrace_getfpxregs=no])])
91 AC_MSG_RESULT($gdbsrv_cv_have_ptrace_getfpxregs)
92 if test "${gdbsrv_cv_have_ptrace_getfpxregs}" = "yes"; then
93 AC_DEFINE(HAVE_PTRACE_GETFPXREGS, 1,
94 [Define if the target supports PTRACE_GETFPXREGS for extended ]
95 [register access.])
96 fi
97 fi
98
99 if test "$ac_cv_header_sys_procfs_h" = yes; then
100 BFD_HAVE_SYS_PROCFS_TYPE(lwpid_t)
101 BFD_HAVE_SYS_PROCFS_TYPE(psaddr_t)
102 BFD_HAVE_SYS_PROCFS_TYPE(prgregset_t)
103 BFD_HAVE_SYS_PROCFS_TYPE(elf_fpregset_t)
104 fi
105
106 srv_thread_depfiles=
107 srv_libs=
108 USE_THREAD_DB=
109
110 if test "$srv_linux_thread_db" = "yes"; then
111 SRV_CHECK_THREAD_DB
112 if test "$srv_cv_thread_db" = no; then
113 AC_WARN([Could not find libthread_db.])
114 AC_WARN([Disabling thread support in gdbserver.])
115 srv_linux_thread_db=no
116 else
117 srv_libs="$srv_cv_thread_db"
118 fi
119 old_LDFLAGS="$LDFLAGS"
120 LDFLAGS="$LDFLAGS -rdynamic"
121 AC_TRY_LINK([], [], [RDYNAMIC=-rdynamic], [RDYNAMIC=])
122 AC_SUBST(RDYNAMIC)
123 LDFLAGS="$old_LDFLAGS"
124 fi
125
126 if test "$srv_linux_thread_db" = "yes"; then
127 srv_thread_depfiles="thread-db.o proc-service.o"
128 USE_THREAD_DB="-DUSE_THREAD_DB"
129 AC_CACHE_CHECK([for TD_VERSION], gdbsrv_cv_have_td_version,
130 [AC_TRY_COMPILE([#include <thread_db.h>], [TD_VERSION;],
131 [gdbsrv_cv_have_td_version=yes],
132 [gdbsrv_cv_have_td_version=no])])
133 if test $gdbsrv_cv_have_td_version = yes; then
134 AC_DEFINE(HAVE_TD_VERSION, 1, [Define if TD_VERSION is available.])
135 fi
136 fi
137
138 GDBSERVER_DEPFILES="$srv_regobj $srv_tgtobj $srv_thread_depfiles"
139 GDBSERVER_LIBS="$srv_libs"
140
141 AC_SUBST(GDBSERVER_DEPFILES)
142 AC_SUBST(GDBSERVER_LIBS)
143 AC_SUBST(USE_THREAD_DB)
144
145 AC_OUTPUT(Makefile,
146 [case x$CONFIG_HEADERS in
147 xconfig.h:config.in)
148 echo > stamp-h ;;
149 esac
150 ])
This page took 0.03325 seconds and 5 git commands to generate.