Adding Neutrino gdbserver.
[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, 2007, 2008
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 3 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, see <http://www.gnu.org/licenses/>.
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 AC_CONFIG_LIBOBJ_DIR(../gnulib)
27
28 AC_PROG_CC
29 AC_GNU_SOURCE
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 errno.h fcntl.h signal.h sys/file.h malloc.h dnl
43 sys/ioctl.h netinet/in.h sys/socket.h netdb.h dnl
44 netinet/tcp.h arpa/inet.h sys/wait.h)
45 AC_CHECK_FUNCS(pread pwrite pread64)
46 AC_REPLACE_FUNCS(memmem)
47
48 have_errno=no
49 AC_MSG_CHECKING(for errno)
50 AC_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])
55 if test $have_errno = no; then
56 AC_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)])
62 fi
63
64 AC_CHECK_DECLS([strerror, perror, memmem])
65
66 AC_CHECK_TYPES(socklen_t, [], [],
67 [#include <sys/types.h>
68 #include <sys/socket.h>
69 ])
70
71 ACX_PKGVERSION([GDB])
72 ACX_BUGURL([http://www.gnu.org/software/gdb/bugs/])
73 AC_DEFINE_UNQUOTED([PKGVERSION], ["$PKGVERSION"], [Additional package description])
74 AC_DEFINE_UNQUOTED([REPORT_BUGS_TO], ["$REPORT_BUGS_TO"], [Bug reporting address])
75
76 . ${srcdir}/configure.srv
77
78 if test "${srv_mingwce}" = "yes"; then
79 LIBS="$LIBS -lws2"
80 elif test "${srv_mingw}" = "yes"; then
81 LIBS="$LIBS -lwsock32"
82 elif test "${srv_qnx}" = "yes"; then
83 LIBS="$LIBS -lsocket"
84 fi
85
86 if test "${srv_mingw}" = "yes"; then
87 AC_DEFINE(USE_WIN32API, 1,
88 [Define if we should use the Windows API, instead of the
89 POSIX API. On Windows, we use the Windows API when
90 building for MinGW, but the POSIX API when building
91 for Cygwin.])
92 fi
93
94 if test "${srv_linux_usrregs}" = "yes"; then
95 AC_DEFINE(HAVE_LINUX_USRREGS, 1,
96 [Define if the target supports PTRACE_PEEKUSR for register ]
97 [access.])
98 fi
99
100 if test "${srv_linux_regsets}" = "yes"; then
101 AC_DEFINE(HAVE_LINUX_REGSETS, 1,
102 [Define if the target supports register sets.])
103
104 AC_MSG_CHECKING(for PTRACE_GETREGS)
105 AC_CACHE_VAL(gdbsrv_cv_have_ptrace_getregs,
106 [AC_TRY_COMPILE([#include <sys/ptrace.h>],
107 [PTRACE_GETREGS;],
108 [gdbsrv_cv_have_ptrace_getregs=yes],
109 [gdbsrv_cv_have_ptrace_getregs=no])])
110 AC_MSG_RESULT($gdbsrv_cv_have_ptrace_getregs)
111 if test "${gdbsrv_cv_have_ptrace_getregs}" = "yes"; then
112 AC_DEFINE(HAVE_PTRACE_GETREGS, 1,
113 [Define if the target supports PTRACE_GETREGS for register ]
114 [access.])
115 fi
116
117 AC_MSG_CHECKING(for PTRACE_GETFPXREGS)
118 AC_CACHE_VAL(gdbsrv_cv_have_ptrace_getfpxregs,
119 [AC_TRY_COMPILE([#include <sys/ptrace.h>],
120 [PTRACE_GETFPXREGS;],
121 [gdbsrv_cv_have_ptrace_getfpxregs=yes],
122 [gdbsrv_cv_have_ptrace_getfpxregs=no])])
123 AC_MSG_RESULT($gdbsrv_cv_have_ptrace_getfpxregs)
124 if test "${gdbsrv_cv_have_ptrace_getfpxregs}" = "yes"; then
125 AC_DEFINE(HAVE_PTRACE_GETFPXREGS, 1,
126 [Define if the target supports PTRACE_GETFPXREGS for extended ]
127 [register access.])
128 fi
129 fi
130
131 if test "$ac_cv_header_sys_procfs_h" = yes; then
132 BFD_HAVE_SYS_PROCFS_TYPE(lwpid_t)
133 BFD_HAVE_SYS_PROCFS_TYPE(psaddr_t)
134 BFD_HAVE_SYS_PROCFS_TYPE(prgregset_t)
135 BFD_HAVE_SYS_PROCFS_TYPE(elf_fpregset_t)
136 fi
137
138 srv_thread_depfiles=
139 srv_libs=
140 USE_THREAD_DB=
141
142 if test "$srv_linux_thread_db" = "yes"; then
143 SRV_CHECK_THREAD_DB
144 if test "$srv_cv_thread_db" = no; then
145 AC_WARN([Could not find libthread_db.])
146 AC_WARN([Disabling thread support in gdbserver.])
147 srv_linux_thread_db=no
148 else
149 srv_libs="$srv_cv_thread_db"
150 SRV_CHECK_TLS_GET_ADDR
151 fi
152 old_LDFLAGS="$LDFLAGS"
153 LDFLAGS="$LDFLAGS -rdynamic"
154 AC_TRY_LINK([], [], [RDYNAMIC=-rdynamic], [RDYNAMIC=])
155 AC_SUBST(RDYNAMIC)
156 LDFLAGS="$old_LDFLAGS"
157 fi
158
159 if test "$srv_linux_thread_db" = "yes"; then
160 srv_thread_depfiles="thread-db.o proc-service.o"
161 USE_THREAD_DB="-DUSE_THREAD_DB"
162 AC_CACHE_CHECK([for TD_VERSION], gdbsrv_cv_have_td_version,
163 [AC_TRY_COMPILE([#include <thread_db.h>], [TD_VERSION;],
164 [gdbsrv_cv_have_td_version=yes],
165 [gdbsrv_cv_have_td_version=no])])
166 if test $gdbsrv_cv_have_td_version = yes; then
167 AC_DEFINE(HAVE_TD_VERSION, 1, [Define if TD_VERSION is available.])
168 fi
169
170 if test "$srv_cv_tls_get_addr" = yes; then
171 AC_DEFINE(HAVE_TD_THR_TLS_GET_ADDR, 1, [Define if td_thr_tls_get_addr is available.])
172 fi
173 fi
174
175 if test "$srv_xmlfiles" != ""; then
176 srv_xmlbuiltin="xml-builtin.o"
177 AC_DEFINE(USE_XML, 1, [Define if an XML target description is available.])
178
179 tmp_xmlfiles=$srv_xmlfiles
180 srv_xmlfiles=""
181 for f in $tmp_xmlfiles; do
182 srv_xmlfiles="$srv_xmlfiles \$(XML_DIR)/$f"
183 done
184 fi
185
186 GDBSERVER_DEPFILES="$srv_regobj $srv_tgtobj $srv_hostio_err_objs $srv_thread_depfiles"
187 GDBSERVER_LIBS="$srv_libs"
188
189 AC_SUBST(GDBSERVER_DEPFILES)
190 AC_SUBST(GDBSERVER_LIBS)
191 AC_SUBST(USE_THREAD_DB)
192 AC_SUBST(srv_xmlbuiltin)
193 AC_SUBST(srv_xmlfiles)
194
195 AC_OUTPUT(Makefile,
196 [case x$CONFIG_HEADERS in
197 xconfig.h:config.in)
198 echo > stamp-h ;;
199 esac
200 ])
This page took 0.035533 seconds and 4 git commands to generate.