Commit | Line | Data |
---|---|---|
d6e9fb05 | 1 | dnl Autoconf configure script for GDB server. |
0050a760 DJ |
2 | dnl Copyright (C) 2000, 2002, 2003, 2004, 2005, 2006 |
3 | dnl Free Software Foundation, Inc. | |
d6e9fb05 JK |
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 | |
6f0f660e EZ |
19 | dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, |
20 | dnl Boston, MA 02110-1301, USA. | |
d6e9fb05 JK |
21 | |
22 | dnl Process this file with autoconf to produce a configure script. | |
23 | ||
bec39cab AC |
24 | AC_PREREQ(2.59)dnl |
25 | ||
d6e9fb05 | 26 | AC_INIT(server.c) |
84563040 DJ |
27 | AC_CONFIG_HEADER(config.h:config.in) |
28 | ||
29 | AC_PROG_CC | |
d6e9fb05 JK |
30 | |
31 | AC_CANONICAL_SYSTEM | |
84563040 | 32 | |
d6e9fb05 | 33 | AC_PROG_INSTALL |
c906108c | 34 | |
dcdb98d2 DJ |
35 | AC_ARG_PROGRAM |
36 | ||
ee6e2b82 | 37 | AC_HEADER_STDC |
84563040 | 38 | |
0d62e5e8 | 39 | AC_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) |
84563040 | 45 | |
68070c10 PA |
46 | have_errno=no |
47 | AC_MSG_CHECKING(for errno) | |
48 | AC_TRY_LINK([ | |
49 | #if HAVE_ERRNO_H | |
50 | #include <errno.h> | |
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 <errno.h> | |
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]) | |
43d5792c | 63 | |
ccbd4912 MK |
64 | AC_CHECK_TYPES(socklen_t, [], [], |
65 | [#include <sys/types.h> | |
66 | #include <sys/socket.h> | |
67 | ]) | |
fb1e4ffc DJ |
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 | esac | |
85 | ||
7ea81414 | 86 | . ${srcdir}/configure.srv |
c906108c | 87 | |
68070c10 PA |
88 | if test "${srv_mingwce}" = "yes"; then |
89 | LIBS="$LIBS -lws2" | |
90 | elif test "${srv_mingw}" = "yes"; then | |
b80864fb | 91 | LIBS="$LIBS -lwsock32" |
68070c10 PA |
92 | fi |
93 | ||
94 | if test "${srv_mingw}" = "yes"; then | |
b80864fb DJ |
95 | AC_DEFINE(USE_WIN32API, 1, |
96 | [Define if we should use the Windows API, instead of the | |
97 | POSIX API. On Windows, we use the Windows API when | |
98 | building for MinGW, but the POSIX API when building | |
99 | for Cygwin.]) | |
100 | fi | |
101 | ||
58caa3dc | 102 | if test "${srv_linux_usrregs}" = "yes"; then |
f450004a DJ |
103 | AC_DEFINE(HAVE_LINUX_USRREGS, 1, |
104 | [Define if the target supports PTRACE_PEEKUSR for register ] | |
105 | [access.]) | |
58caa3dc DJ |
106 | fi |
107 | ||
108 | if test "${srv_linux_regsets}" = "yes"; then | |
e9d25b98 DJ |
109 | AC_DEFINE(HAVE_LINUX_REGSETS, 1, |
110 | [Define if the target supports register sets.]) | |
111 | ||
58caa3dc DJ |
112 | AC_MSG_CHECKING(for PTRACE_GETREGS) |
113 | AC_CACHE_VAL(gdbsrv_cv_have_ptrace_getregs, | |
114 | [AC_TRY_COMPILE([#include <sys/ptrace.h>], | |
115 | [PTRACE_GETREGS;], | |
116 | [gdbsrv_cv_have_ptrace_getregs=yes], | |
117 | [gdbsrv_cv_have_ptrace_getregs=no])]) | |
118 | AC_MSG_RESULT($gdbsrv_cv_have_ptrace_getregs) | |
119 | if test "${gdbsrv_cv_have_ptrace_getregs}" = "yes"; then | |
e9d25b98 | 120 | AC_DEFINE(HAVE_PTRACE_GETREGS, 1, |
f450004a DJ |
121 | [Define if the target supports PTRACE_GETREGS for register ] |
122 | [access.]) | |
58caa3dc DJ |
123 | fi |
124 | ||
125 | AC_MSG_CHECKING(for PTRACE_GETFPXREGS) | |
126 | AC_CACHE_VAL(gdbsrv_cv_have_ptrace_getfpxregs, | |
127 | [AC_TRY_COMPILE([#include <sys/ptrace.h>], | |
128 | [PTRACE_GETFPXREGS;], | |
129 | [gdbsrv_cv_have_ptrace_getfpxregs=yes], | |
130 | [gdbsrv_cv_have_ptrace_getfpxregs=no])]) | |
131 | AC_MSG_RESULT($gdbsrv_cv_have_ptrace_getfpxregs) | |
132 | if test "${gdbsrv_cv_have_ptrace_getfpxregs}" = "yes"; then | |
f450004a DJ |
133 | AC_DEFINE(HAVE_PTRACE_GETFPXREGS, 1, |
134 | [Define if the target supports PTRACE_GETFPXREGS for extended ] | |
135 | [register access.]) | |
58caa3dc DJ |
136 | fi |
137 | fi | |
138 | ||
0d62e5e8 DJ |
139 | if test "$ac_cv_header_sys_procfs_h" = yes; then |
140 | BFD_HAVE_SYS_PROCFS_TYPE(lwpid_t) | |
141 | BFD_HAVE_SYS_PROCFS_TYPE(psaddr_t) | |
142 | BFD_HAVE_SYS_PROCFS_TYPE(prgregset_t) | |
0d62e5e8 DJ |
143 | BFD_HAVE_SYS_PROCFS_TYPE(elf_fpregset_t) |
144 | fi | |
145 | ||
146 | srv_thread_depfiles= | |
147 | srv_libs= | |
148 | USE_THREAD_DB= | |
149 | ||
150 | if test "$srv_linux_thread_db" = "yes"; then | |
151 | SRV_CHECK_THREAD_DB | |
152 | if test "$srv_cv_thread_db" = no; then | |
153 | AC_WARN([Could not find libthread_db.]) | |
154 | AC_WARN([Disabling thread support in gdbserver.]) | |
155 | srv_linux_thread_db=no | |
156 | else | |
157 | srv_libs="$srv_cv_thread_db" | |
dae5f5cf | 158 | SRV_CHECK_TLS_GET_ADDR |
0d62e5e8 | 159 | fi |
f6de3c42 DJ |
160 | old_LDFLAGS="$LDFLAGS" |
161 | LDFLAGS="$LDFLAGS -rdynamic" | |
162 | AC_TRY_LINK([], [], [RDYNAMIC=-rdynamic], [RDYNAMIC=]) | |
163 | AC_SUBST(RDYNAMIC) | |
164 | LDFLAGS="$old_LDFLAGS" | |
0d62e5e8 DJ |
165 | fi |
166 | ||
167 | if test "$srv_linux_thread_db" = "yes"; then | |
168 | srv_thread_depfiles="thread-db.o proc-service.o" | |
169 | USE_THREAD_DB="-DUSE_THREAD_DB" | |
3db0444b DJ |
170 | AC_CACHE_CHECK([for TD_VERSION], gdbsrv_cv_have_td_version, |
171 | [AC_TRY_COMPILE([#include <thread_db.h>], [TD_VERSION;], | |
172 | [gdbsrv_cv_have_td_version=yes], | |
173 | [gdbsrv_cv_have_td_version=no])]) | |
174 | if test $gdbsrv_cv_have_td_version = yes; then | |
175 | AC_DEFINE(HAVE_TD_VERSION, 1, [Define if TD_VERSION is available.]) | |
176 | fi | |
dae5f5cf | 177 | |
cb7283db | 178 | if test "$srv_cv_tls_get_addr" = yes; then |
dae5f5cf DJ |
179 | AC_DEFINE(HAVE_TD_THR_TLS_GET_ADDR, 1, [Define if td_thr_tls_get_addr is available.]) |
180 | fi | |
0d62e5e8 DJ |
181 | fi |
182 | ||
fb1e4ffc DJ |
183 | if test "$srv_xmltarget" != ""; then |
184 | srv_xmltarget="\$(XML_DIR)/$srv_xmltarget" | |
185 | srv_xmlbuiltin="xml-builtin.o" | |
186 | AC_DEFINE(USE_XML, 1, [Define if an XML target description is available.]) | |
187 | ||
188 | tmp_xmlfiles=$srv_xmlfiles | |
189 | srv_xmlfiles="target.xml" | |
190 | for f in $tmp_xmlfiles; do | |
191 | srv_xmlfiles="$srv_xmlfiles \$(XML_DIR)/$f" | |
192 | done | |
193 | fi | |
194 | ||
0d62e5e8 DJ |
195 | GDBSERVER_DEPFILES="$srv_regobj $srv_tgtobj $srv_thread_depfiles" |
196 | GDBSERVER_LIBS="$srv_libs" | |
c906108c | 197 | |
7ea81414 | 198 | AC_SUBST(GDBSERVER_DEPFILES) |
0d62e5e8 DJ |
199 | AC_SUBST(GDBSERVER_LIBS) |
200 | AC_SUBST(USE_THREAD_DB) | |
fb1e4ffc DJ |
201 | AC_SUBST(srv_xmlbuiltin) |
202 | AC_SUBST(srv_xmlfiles) | |
203 | AC_SUBST(srv_xmltarget) | |
c906108c | 204 | |
c3a3ccc7 DJ |
205 | AC_OUTPUT(Makefile, |
206 | [case x$CONFIG_HEADERS in | |
207 | xconfig.h:config.in) | |
208 | echo > stamp-h ;; | |
209 | esac | |
210 | ]) |