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 | |
5a0e3bd0 | 9 | dnl the Free Software Foundation; either version 3 of the License, or |
d6e9fb05 JK |
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 | |
5a0e3bd0 | 18 | dnl along with this program. If not, see <http://www.gnu.org/licenses/>. |
d6e9fb05 JK |
19 | |
20 | dnl Process this file with autoconf to produce a configure script. | |
21 | ||
bec39cab AC |
22 | AC_PREREQ(2.59)dnl |
23 | ||
d6e9fb05 | 24 | AC_INIT(server.c) |
84563040 DJ |
25 | AC_CONFIG_HEADER(config.h:config.in) |
26 | ||
27 | AC_PROG_CC | |
d6e9fb05 JK |
28 | |
29 | AC_CANONICAL_SYSTEM | |
84563040 | 30 | |
d6e9fb05 | 31 | AC_PROG_INSTALL |
c906108c | 32 | |
dcdb98d2 DJ |
33 | AC_ARG_PROGRAM |
34 | ||
ee6e2b82 | 35 | AC_HEADER_STDC |
84563040 | 36 | |
0d62e5e8 | 37 | AC_CHECK_HEADERS(sgtty.h termio.h termios.h sys/reg.h string.h dnl |
94e10508 | 38 | proc_service.h sys/procfs.h thread_db.h linux/elf.h dnl |
b80864fb | 39 | stdlib.h unistd.h dnl |
68070c10 | 40 | errno.h fcntl.h signal.h sys/file.h malloc.h dnl |
61ff6e04 | 41 | sys/ioctl.h netinet/in.h sys/socket.h netdb.h dnl |
b80864fb | 42 | netinet/tcp.h arpa/inet.h sys/wait.h) |
84563040 | 43 | |
68070c10 PA |
44 | have_errno=no |
45 | AC_MSG_CHECKING(for errno) | |
46 | AC_TRY_LINK([ | |
47 | #if HAVE_ERRNO_H | |
48 | #include <errno.h> | |
49 | #endif], [static int x; x = errno;], | |
50 | [AC_MSG_RESULT(yes - in errno.h); AC_DEFINE(HAVE_ERRNO, 1, [Define if errno is available]) have_errno=yes]) | |
51 | if test $have_errno = no; then | |
52 | AC_TRY_LINK([ | |
53 | #if HAVE_ERRNO_H | |
54 | #include <errno.h> | |
55 | #endif], [extern int errno; static int x; x = errno;], | |
56 | [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])], | |
57 | [AC_MSG_RESULT(no)]) | |
58 | fi | |
59 | ||
60 | AC_CHECK_DECLS([strerror, perror]) | |
43d5792c | 61 | |
ccbd4912 MK |
62 | AC_CHECK_TYPES(socklen_t, [], [], |
63 | [#include <sys/types.h> | |
64 | #include <sys/socket.h> | |
65 | ]) | |
fb1e4ffc DJ |
66 | |
67 | # Check for various supplementary target information (beyond the | |
68 | # triplet) which might affect the choices in configure.srv. | |
69 | case "${target}" in | |
70 | arm*-*-linux*) | |
71 | AC_CACHE_CHECK([if iWMMXt is selected], [gdb_cv_arm_iwmmxt], | |
72 | [save_CPPFLAGS="$CPPFLAGS" | |
73 | CPPFLAGS="$CPPFLAGS $CFLAGS" | |
74 | AC_EGREP_CPP([got it], [ | |
75 | #ifdef __IWMMXT__ | |
76 | got it | |
77 | #endif | |
78 | ], [gdb_cv_arm_iwmmxt=yes], | |
79 | [gdb_cv_arm_iwmmxt=no]) | |
80 | CPPFLAGS="$save_CPPFLAGS"]) | |
81 | ;; | |
82 | esac | |
83 | ||
7ea81414 | 84 | . ${srcdir}/configure.srv |
c906108c | 85 | |
68070c10 PA |
86 | if test "${srv_mingwce}" = "yes"; then |
87 | LIBS="$LIBS -lws2" | |
88 | elif test "${srv_mingw}" = "yes"; then | |
b80864fb | 89 | LIBS="$LIBS -lwsock32" |
68070c10 PA |
90 | fi |
91 | ||
92 | if test "${srv_mingw}" = "yes"; then | |
b80864fb DJ |
93 | AC_DEFINE(USE_WIN32API, 1, |
94 | [Define if we should use the Windows API, instead of the | |
95 | POSIX API. On Windows, we use the Windows API when | |
96 | building for MinGW, but the POSIX API when building | |
97 | for Cygwin.]) | |
98 | fi | |
99 | ||
58caa3dc | 100 | if test "${srv_linux_usrregs}" = "yes"; then |
f450004a DJ |
101 | AC_DEFINE(HAVE_LINUX_USRREGS, 1, |
102 | [Define if the target supports PTRACE_PEEKUSR for register ] | |
103 | [access.]) | |
58caa3dc DJ |
104 | fi |
105 | ||
106 | if test "${srv_linux_regsets}" = "yes"; then | |
e9d25b98 DJ |
107 | AC_DEFINE(HAVE_LINUX_REGSETS, 1, |
108 | [Define if the target supports register sets.]) | |
109 | ||
58caa3dc DJ |
110 | AC_MSG_CHECKING(for PTRACE_GETREGS) |
111 | AC_CACHE_VAL(gdbsrv_cv_have_ptrace_getregs, | |
112 | [AC_TRY_COMPILE([#include <sys/ptrace.h>], | |
113 | [PTRACE_GETREGS;], | |
114 | [gdbsrv_cv_have_ptrace_getregs=yes], | |
115 | [gdbsrv_cv_have_ptrace_getregs=no])]) | |
116 | AC_MSG_RESULT($gdbsrv_cv_have_ptrace_getregs) | |
117 | if test "${gdbsrv_cv_have_ptrace_getregs}" = "yes"; then | |
e9d25b98 | 118 | AC_DEFINE(HAVE_PTRACE_GETREGS, 1, |
f450004a DJ |
119 | [Define if the target supports PTRACE_GETREGS for register ] |
120 | [access.]) | |
58caa3dc DJ |
121 | fi |
122 | ||
123 | AC_MSG_CHECKING(for PTRACE_GETFPXREGS) | |
124 | AC_CACHE_VAL(gdbsrv_cv_have_ptrace_getfpxregs, | |
125 | [AC_TRY_COMPILE([#include <sys/ptrace.h>], | |
126 | [PTRACE_GETFPXREGS;], | |
127 | [gdbsrv_cv_have_ptrace_getfpxregs=yes], | |
128 | [gdbsrv_cv_have_ptrace_getfpxregs=no])]) | |
129 | AC_MSG_RESULT($gdbsrv_cv_have_ptrace_getfpxregs) | |
130 | if test "${gdbsrv_cv_have_ptrace_getfpxregs}" = "yes"; then | |
f450004a DJ |
131 | AC_DEFINE(HAVE_PTRACE_GETFPXREGS, 1, |
132 | [Define if the target supports PTRACE_GETFPXREGS for extended ] | |
133 | [register access.]) | |
58caa3dc DJ |
134 | fi |
135 | fi | |
136 | ||
0d62e5e8 DJ |
137 | if test "$ac_cv_header_sys_procfs_h" = yes; then |
138 | BFD_HAVE_SYS_PROCFS_TYPE(lwpid_t) | |
139 | BFD_HAVE_SYS_PROCFS_TYPE(psaddr_t) | |
140 | BFD_HAVE_SYS_PROCFS_TYPE(prgregset_t) | |
0d62e5e8 DJ |
141 | BFD_HAVE_SYS_PROCFS_TYPE(elf_fpregset_t) |
142 | fi | |
143 | ||
144 | srv_thread_depfiles= | |
145 | srv_libs= | |
146 | USE_THREAD_DB= | |
147 | ||
148 | if test "$srv_linux_thread_db" = "yes"; then | |
149 | SRV_CHECK_THREAD_DB | |
150 | if test "$srv_cv_thread_db" = no; then | |
151 | AC_WARN([Could not find libthread_db.]) | |
152 | AC_WARN([Disabling thread support in gdbserver.]) | |
153 | srv_linux_thread_db=no | |
154 | else | |
155 | srv_libs="$srv_cv_thread_db" | |
dae5f5cf | 156 | SRV_CHECK_TLS_GET_ADDR |
0d62e5e8 | 157 | fi |
f6de3c42 DJ |
158 | old_LDFLAGS="$LDFLAGS" |
159 | LDFLAGS="$LDFLAGS -rdynamic" | |
160 | AC_TRY_LINK([], [], [RDYNAMIC=-rdynamic], [RDYNAMIC=]) | |
161 | AC_SUBST(RDYNAMIC) | |
162 | LDFLAGS="$old_LDFLAGS" | |
0d62e5e8 DJ |
163 | fi |
164 | ||
165 | if test "$srv_linux_thread_db" = "yes"; then | |
166 | srv_thread_depfiles="thread-db.o proc-service.o" | |
167 | USE_THREAD_DB="-DUSE_THREAD_DB" | |
3db0444b DJ |
168 | AC_CACHE_CHECK([for TD_VERSION], gdbsrv_cv_have_td_version, |
169 | [AC_TRY_COMPILE([#include <thread_db.h>], [TD_VERSION;], | |
170 | [gdbsrv_cv_have_td_version=yes], | |
171 | [gdbsrv_cv_have_td_version=no])]) | |
172 | if test $gdbsrv_cv_have_td_version = yes; then | |
173 | AC_DEFINE(HAVE_TD_VERSION, 1, [Define if TD_VERSION is available.]) | |
174 | fi | |
dae5f5cf | 175 | |
cb7283db | 176 | if test "$srv_cv_tls_get_addr" = yes; then |
dae5f5cf DJ |
177 | AC_DEFINE(HAVE_TD_THR_TLS_GET_ADDR, 1, [Define if td_thr_tls_get_addr is available.]) |
178 | fi | |
0d62e5e8 DJ |
179 | fi |
180 | ||
fb1e4ffc DJ |
181 | if test "$srv_xmltarget" != ""; then |
182 | srv_xmltarget="\$(XML_DIR)/$srv_xmltarget" | |
183 | srv_xmlbuiltin="xml-builtin.o" | |
184 | AC_DEFINE(USE_XML, 1, [Define if an XML target description is available.]) | |
185 | ||
186 | tmp_xmlfiles=$srv_xmlfiles | |
187 | srv_xmlfiles="target.xml" | |
188 | for f in $tmp_xmlfiles; do | |
189 | srv_xmlfiles="$srv_xmlfiles \$(XML_DIR)/$f" | |
190 | done | |
191 | fi | |
192 | ||
0d62e5e8 DJ |
193 | GDBSERVER_DEPFILES="$srv_regobj $srv_tgtobj $srv_thread_depfiles" |
194 | GDBSERVER_LIBS="$srv_libs" | |
c906108c | 195 | |
7ea81414 | 196 | AC_SUBST(GDBSERVER_DEPFILES) |
0d62e5e8 DJ |
197 | AC_SUBST(GDBSERVER_LIBS) |
198 | AC_SUBST(USE_THREAD_DB) | |
fb1e4ffc DJ |
199 | AC_SUBST(srv_xmlbuiltin) |
200 | AC_SUBST(srv_xmlfiles) | |
201 | AC_SUBST(srv_xmltarget) | |
c906108c | 202 | |
c3a3ccc7 DJ |
203 | AC_OUTPUT(Makefile, |
204 | [case x$CONFIG_HEADERS in | |
205 | xconfig.h:config.in) | |
206 | echo > stamp-h ;; | |
207 | esac | |
208 | ]) |