1 |
24 |
jeremybenn |
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 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 .
|
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 |
|
|
|
27 |
|
|
AC_PROG_CC
|
28 |
|
|
AC_GNU_SOURCE
|
29 |
|
|
|
30 |
|
|
AC_CANONICAL_SYSTEM
|
31 |
|
|
|
32 |
|
|
AC_PROG_INSTALL
|
33 |
|
|
|
34 |
|
|
AC_ARG_PROGRAM
|
35 |
|
|
|
36 |
|
|
AC_HEADER_STDC
|
37 |
|
|
|
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
|
40 |
|
|
stdlib.h unistd.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)
|
45 |
|
|
|
46 |
|
|
have_errno=no
|
47 |
|
|
AC_MSG_CHECKING(for errno)
|
48 |
|
|
AC_TRY_LINK([
|
49 |
|
|
#if HAVE_ERRNO_H
|
50 |
|
|
#include
|
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
|
54 |
|
|
AC_TRY_LINK([
|
55 |
|
|
#if HAVE_ERRNO_H
|
56 |
|
|
#include
|
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])],
|
59 |
|
|
[AC_MSG_RESULT(no)])
|
60 |
|
|
fi
|
61 |
|
|
|
62 |
|
|
AC_CHECK_DECLS([strerror, perror])
|
63 |
|
|
|
64 |
|
|
AC_CHECK_TYPES(socklen_t, [], [],
|
65 |
|
|
[#include
|
66 |
|
|
#include
|
67 |
|
|
])
|
68 |
|
|
|
69 |
|
|
# Check for various supplementary target information (beyond the
|
70 |
|
|
# triplet) which might affect the choices in configure.srv.
|
71 |
|
|
case "${target}" in
|
72 |
|
|
arm*-*-linux*)
|
73 |
|
|
AC_CACHE_CHECK([if iWMMXt is selected], [gdb_cv_arm_iwmmxt],
|
74 |
|
|
[save_CPPFLAGS="$CPPFLAGS"
|
75 |
|
|
CPPFLAGS="$CPPFLAGS $CFLAGS"
|
76 |
|
|
AC_EGREP_CPP([got it], [
|
77 |
|
|
#ifdef __IWMMXT__
|
78 |
|
|
got it
|
79 |
|
|
#endif
|
80 |
|
|
], [gdb_cv_arm_iwmmxt=yes],
|
81 |
|
|
[gdb_cv_arm_iwmmxt=no])
|
82 |
|
|
CPPFLAGS="$save_CPPFLAGS"])
|
83 |
|
|
;;
|
84 |
|
|
powerpc*-*-*)
|
85 |
|
|
AC_CACHE_CHECK([if Altivec is selected], [gdb_cv_ppc_altivec],
|
86 |
|
|
[save_CPPFLAGS="$CPPFLAGS"
|
87 |
|
|
CPPFLAGS="$CPPFLAGS $CFLAGS"
|
88 |
|
|
AC_EGREP_CPP([got it], [
|
89 |
|
|
#ifdef __ALTIVEC__
|
90 |
|
|
got it
|
91 |
|
|
#endif
|
92 |
|
|
], [gdb_cv_ppc_altivec=yes],
|
93 |
|
|
[gdb_cv_ppc_altivec=no])
|
94 |
|
|
CPPFLAGS="$save_CPPFLAGS"])
|
95 |
|
|
AC_CACHE_CHECK([if SPE is selected], [gdb_cv_ppc_spe],
|
96 |
|
|
[save_CPPFLAGS="$CPPFLAGS"
|
97 |
|
|
CPPFLAGS="$CPPFLAGS $CFLAGS"
|
98 |
|
|
AC_EGREP_CPP([got it], [
|
99 |
|
|
#ifdef __SPE__
|
100 |
|
|
got it
|
101 |
|
|
#endif
|
102 |
|
|
], [gdb_cv_ppc_spe=yes],
|
103 |
|
|
[gdb_cv_ppc_spe=no])
|
104 |
|
|
CPPFLAGS="$save_CPPFLAGS"])
|
105 |
|
|
;;
|
106 |
|
|
esac
|
107 |
|
|
|
108 |
|
|
. ${srcdir}/configure.srv
|
109 |
|
|
|
110 |
|
|
if test "${srv_mingwce}" = "yes"; then
|
111 |
|
|
LIBS="$LIBS -lws2"
|
112 |
|
|
elif test "${srv_mingw}" = "yes"; then
|
113 |
|
|
LIBS="$LIBS -lwsock32"
|
114 |
|
|
fi
|
115 |
|
|
|
116 |
|
|
if test "${srv_mingw}" = "yes"; then
|
117 |
|
|
AC_DEFINE(USE_WIN32API, 1,
|
118 |
|
|
[Define if we should use the Windows API, instead of the
|
119 |
|
|
POSIX API. On Windows, we use the Windows API when
|
120 |
|
|
building for MinGW, but the POSIX API when building
|
121 |
|
|
for Cygwin.])
|
122 |
|
|
fi
|
123 |
|
|
|
124 |
|
|
if test "${srv_linux_usrregs}" = "yes"; then
|
125 |
|
|
AC_DEFINE(HAVE_LINUX_USRREGS, 1,
|
126 |
|
|
[Define if the target supports PTRACE_PEEKUSR for register ]
|
127 |
|
|
[access.])
|
128 |
|
|
fi
|
129 |
|
|
|
130 |
|
|
if test "${srv_linux_regsets}" = "yes"; then
|
131 |
|
|
AC_DEFINE(HAVE_LINUX_REGSETS, 1,
|
132 |
|
|
[Define if the target supports register sets.])
|
133 |
|
|
|
134 |
|
|
AC_MSG_CHECKING(for PTRACE_GETREGS)
|
135 |
|
|
AC_CACHE_VAL(gdbsrv_cv_have_ptrace_getregs,
|
136 |
|
|
[AC_TRY_COMPILE([#include ],
|
137 |
|
|
[PTRACE_GETREGS;],
|
138 |
|
|
[gdbsrv_cv_have_ptrace_getregs=yes],
|
139 |
|
|
[gdbsrv_cv_have_ptrace_getregs=no])])
|
140 |
|
|
AC_MSG_RESULT($gdbsrv_cv_have_ptrace_getregs)
|
141 |
|
|
if test "${gdbsrv_cv_have_ptrace_getregs}" = "yes"; then
|
142 |
|
|
AC_DEFINE(HAVE_PTRACE_GETREGS, 1,
|
143 |
|
|
[Define if the target supports PTRACE_GETREGS for register ]
|
144 |
|
|
[access.])
|
145 |
|
|
fi
|
146 |
|
|
|
147 |
|
|
AC_MSG_CHECKING(for PTRACE_GETFPXREGS)
|
148 |
|
|
AC_CACHE_VAL(gdbsrv_cv_have_ptrace_getfpxregs,
|
149 |
|
|
[AC_TRY_COMPILE([#include ],
|
150 |
|
|
[PTRACE_GETFPXREGS;],
|
151 |
|
|
[gdbsrv_cv_have_ptrace_getfpxregs=yes],
|
152 |
|
|
[gdbsrv_cv_have_ptrace_getfpxregs=no])])
|
153 |
|
|
AC_MSG_RESULT($gdbsrv_cv_have_ptrace_getfpxregs)
|
154 |
|
|
if test "${gdbsrv_cv_have_ptrace_getfpxregs}" = "yes"; then
|
155 |
|
|
AC_DEFINE(HAVE_PTRACE_GETFPXREGS, 1,
|
156 |
|
|
[Define if the target supports PTRACE_GETFPXREGS for extended ]
|
157 |
|
|
[register access.])
|
158 |
|
|
fi
|
159 |
|
|
fi
|
160 |
|
|
|
161 |
|
|
if test "$ac_cv_header_sys_procfs_h" = yes; then
|
162 |
|
|
BFD_HAVE_SYS_PROCFS_TYPE(lwpid_t)
|
163 |
|
|
BFD_HAVE_SYS_PROCFS_TYPE(psaddr_t)
|
164 |
|
|
BFD_HAVE_SYS_PROCFS_TYPE(prgregset_t)
|
165 |
|
|
BFD_HAVE_SYS_PROCFS_TYPE(elf_fpregset_t)
|
166 |
|
|
fi
|
167 |
|
|
|
168 |
|
|
srv_thread_depfiles=
|
169 |
|
|
srv_libs=
|
170 |
|
|
USE_THREAD_DB=
|
171 |
|
|
|
172 |
|
|
if test "$srv_linux_thread_db" = "yes"; then
|
173 |
|
|
SRV_CHECK_THREAD_DB
|
174 |
|
|
if test "$srv_cv_thread_db" = no; then
|
175 |
|
|
AC_WARN([Could not find libthread_db.])
|
176 |
|
|
AC_WARN([Disabling thread support in gdbserver.])
|
177 |
|
|
srv_linux_thread_db=no
|
178 |
|
|
else
|
179 |
|
|
srv_libs="$srv_cv_thread_db"
|
180 |
|
|
SRV_CHECK_TLS_GET_ADDR
|
181 |
|
|
fi
|
182 |
|
|
old_LDFLAGS="$LDFLAGS"
|
183 |
|
|
LDFLAGS="$LDFLAGS -rdynamic"
|
184 |
|
|
AC_TRY_LINK([], [], [RDYNAMIC=-rdynamic], [RDYNAMIC=])
|
185 |
|
|
AC_SUBST(RDYNAMIC)
|
186 |
|
|
LDFLAGS="$old_LDFLAGS"
|
187 |
|
|
fi
|
188 |
|
|
|
189 |
|
|
if test "$srv_linux_thread_db" = "yes"; then
|
190 |
|
|
srv_thread_depfiles="thread-db.o proc-service.o"
|
191 |
|
|
USE_THREAD_DB="-DUSE_THREAD_DB"
|
192 |
|
|
AC_CACHE_CHECK([for TD_VERSION], gdbsrv_cv_have_td_version,
|
193 |
|
|
[AC_TRY_COMPILE([#include ], [TD_VERSION;],
|
194 |
|
|
[gdbsrv_cv_have_td_version=yes],
|
195 |
|
|
[gdbsrv_cv_have_td_version=no])])
|
196 |
|
|
if test $gdbsrv_cv_have_td_version = yes; then
|
197 |
|
|
AC_DEFINE(HAVE_TD_VERSION, 1, [Define if TD_VERSION is available.])
|
198 |
|
|
fi
|
199 |
|
|
|
200 |
|
|
if test "$srv_cv_tls_get_addr" = yes; then
|
201 |
|
|
AC_DEFINE(HAVE_TD_THR_TLS_GET_ADDR, 1, [Define if td_thr_tls_get_addr is available.])
|
202 |
|
|
fi
|
203 |
|
|
fi
|
204 |
|
|
|
205 |
|
|
if test "$srv_xmltarget" != ""; then
|
206 |
|
|
srv_xmltarget="\$(XML_DIR)/$srv_xmltarget"
|
207 |
|
|
srv_xmlbuiltin="xml-builtin.o"
|
208 |
|
|
AC_DEFINE(USE_XML, 1, [Define if an XML target description is available.])
|
209 |
|
|
|
210 |
|
|
tmp_xmlfiles=$srv_xmlfiles
|
211 |
|
|
srv_xmlfiles="target.xml"
|
212 |
|
|
for f in $tmp_xmlfiles; do
|
213 |
|
|
srv_xmlfiles="$srv_xmlfiles \$(XML_DIR)/$f"
|
214 |
|
|
done
|
215 |
|
|
fi
|
216 |
|
|
|
217 |
|
|
GDBSERVER_DEPFILES="$srv_regobj $srv_tgtobj $srv_hostio_err_objs $srv_thread_depfiles"
|
218 |
|
|
GDBSERVER_LIBS="$srv_libs"
|
219 |
|
|
|
220 |
|
|
AC_SUBST(GDBSERVER_DEPFILES)
|
221 |
|
|
AC_SUBST(GDBSERVER_LIBS)
|
222 |
|
|
AC_SUBST(USE_THREAD_DB)
|
223 |
|
|
AC_SUBST(srv_xmlbuiltin)
|
224 |
|
|
AC_SUBST(srv_xmlfiles)
|
225 |
|
|
AC_SUBST(srv_xmltarget)
|
226 |
|
|
|
227 |
|
|
AC_OUTPUT(Makefile,
|
228 |
|
|
[case x$CONFIG_HEADERS in
|
229 |
|
|
xconfig.h:config.in)
|
230 |
|
|
echo > stamp-h ;;
|
231 |
|
|
esac
|
232 |
|
|
])
|