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 |
61ff6e04 | 42 | sys/ioctl.h netinet/in.h sys/socket.h netdb.h dnl |
b80864fb | 43 | netinet/tcp.h arpa/inet.h sys/wait.h) |
84563040 | 44 | |
e122f1f5 | 45 | AC_CHECK_DECLS(strerror) |
43d5792c | 46 | |
ccbd4912 MK |
47 | AC_CHECK_TYPES(socklen_t, [], [], |
48 | [#include <sys/types.h> | |
49 | #include <sys/socket.h> | |
50 | ]) | |
fb1e4ffc DJ |
51 | |
52 | # Check for various supplementary target information (beyond the | |
53 | # triplet) which might affect the choices in configure.srv. | |
54 | case "${target}" in | |
55 | arm*-*-linux*) | |
56 | AC_CACHE_CHECK([if iWMMXt is selected], [gdb_cv_arm_iwmmxt], | |
57 | [save_CPPFLAGS="$CPPFLAGS" | |
58 | CPPFLAGS="$CPPFLAGS $CFLAGS" | |
59 | AC_EGREP_CPP([got it], [ | |
60 | #ifdef __IWMMXT__ | |
61 | got it | |
62 | #endif | |
63 | ], [gdb_cv_arm_iwmmxt=yes], | |
64 | [gdb_cv_arm_iwmmxt=no]) | |
65 | CPPFLAGS="$save_CPPFLAGS"]) | |
66 | ;; | |
67 | esac | |
68 | ||
7ea81414 | 69 | . ${srcdir}/configure.srv |
c906108c | 70 | |
b80864fb DJ |
71 | if test "${srv_mingw}" = "yes"; then |
72 | LIBS="$LIBS -lwsock32" | |
73 | AC_DEFINE(USE_WIN32API, 1, | |
74 | [Define if we should use the Windows API, instead of the | |
75 | POSIX API. On Windows, we use the Windows API when | |
76 | building for MinGW, but the POSIX API when building | |
77 | for Cygwin.]) | |
78 | fi | |
79 | ||
58caa3dc | 80 | if test "${srv_linux_usrregs}" = "yes"; then |
f450004a DJ |
81 | AC_DEFINE(HAVE_LINUX_USRREGS, 1, |
82 | [Define if the target supports PTRACE_PEEKUSR for register ] | |
83 | [access.]) | |
58caa3dc DJ |
84 | fi |
85 | ||
86 | if test "${srv_linux_regsets}" = "yes"; then | |
e9d25b98 DJ |
87 | AC_DEFINE(HAVE_LINUX_REGSETS, 1, |
88 | [Define if the target supports register sets.]) | |
89 | ||
58caa3dc DJ |
90 | AC_MSG_CHECKING(for PTRACE_GETREGS) |
91 | AC_CACHE_VAL(gdbsrv_cv_have_ptrace_getregs, | |
92 | [AC_TRY_COMPILE([#include <sys/ptrace.h>], | |
93 | [PTRACE_GETREGS;], | |
94 | [gdbsrv_cv_have_ptrace_getregs=yes], | |
95 | [gdbsrv_cv_have_ptrace_getregs=no])]) | |
96 | AC_MSG_RESULT($gdbsrv_cv_have_ptrace_getregs) | |
97 | if test "${gdbsrv_cv_have_ptrace_getregs}" = "yes"; then | |
e9d25b98 | 98 | AC_DEFINE(HAVE_PTRACE_GETREGS, 1, |
f450004a DJ |
99 | [Define if the target supports PTRACE_GETREGS for register ] |
100 | [access.]) | |
58caa3dc DJ |
101 | fi |
102 | ||
103 | AC_MSG_CHECKING(for PTRACE_GETFPXREGS) | |
104 | AC_CACHE_VAL(gdbsrv_cv_have_ptrace_getfpxregs, | |
105 | [AC_TRY_COMPILE([#include <sys/ptrace.h>], | |
106 | [PTRACE_GETFPXREGS;], | |
107 | [gdbsrv_cv_have_ptrace_getfpxregs=yes], | |
108 | [gdbsrv_cv_have_ptrace_getfpxregs=no])]) | |
109 | AC_MSG_RESULT($gdbsrv_cv_have_ptrace_getfpxregs) | |
110 | if test "${gdbsrv_cv_have_ptrace_getfpxregs}" = "yes"; then | |
f450004a DJ |
111 | AC_DEFINE(HAVE_PTRACE_GETFPXREGS, 1, |
112 | [Define if the target supports PTRACE_GETFPXREGS for extended ] | |
113 | [register access.]) | |
58caa3dc DJ |
114 | fi |
115 | fi | |
116 | ||
0d62e5e8 DJ |
117 | if test "$ac_cv_header_sys_procfs_h" = yes; then |
118 | BFD_HAVE_SYS_PROCFS_TYPE(lwpid_t) | |
119 | BFD_HAVE_SYS_PROCFS_TYPE(psaddr_t) | |
120 | BFD_HAVE_SYS_PROCFS_TYPE(prgregset_t) | |
0d62e5e8 DJ |
121 | BFD_HAVE_SYS_PROCFS_TYPE(elf_fpregset_t) |
122 | fi | |
123 | ||
124 | srv_thread_depfiles= | |
125 | srv_libs= | |
126 | USE_THREAD_DB= | |
127 | ||
128 | if test "$srv_linux_thread_db" = "yes"; then | |
129 | SRV_CHECK_THREAD_DB | |
130 | if test "$srv_cv_thread_db" = no; then | |
131 | AC_WARN([Could not find libthread_db.]) | |
132 | AC_WARN([Disabling thread support in gdbserver.]) | |
133 | srv_linux_thread_db=no | |
134 | else | |
135 | srv_libs="$srv_cv_thread_db" | |
dae5f5cf | 136 | SRV_CHECK_TLS_GET_ADDR |
0d62e5e8 | 137 | fi |
f6de3c42 DJ |
138 | old_LDFLAGS="$LDFLAGS" |
139 | LDFLAGS="$LDFLAGS -rdynamic" | |
140 | AC_TRY_LINK([], [], [RDYNAMIC=-rdynamic], [RDYNAMIC=]) | |
141 | AC_SUBST(RDYNAMIC) | |
142 | LDFLAGS="$old_LDFLAGS" | |
0d62e5e8 DJ |
143 | fi |
144 | ||
145 | if test "$srv_linux_thread_db" = "yes"; then | |
146 | srv_thread_depfiles="thread-db.o proc-service.o" | |
147 | USE_THREAD_DB="-DUSE_THREAD_DB" | |
3db0444b DJ |
148 | AC_CACHE_CHECK([for TD_VERSION], gdbsrv_cv_have_td_version, |
149 | [AC_TRY_COMPILE([#include <thread_db.h>], [TD_VERSION;], | |
150 | [gdbsrv_cv_have_td_version=yes], | |
151 | [gdbsrv_cv_have_td_version=no])]) | |
152 | if test $gdbsrv_cv_have_td_version = yes; then | |
153 | AC_DEFINE(HAVE_TD_VERSION, 1, [Define if TD_VERSION is available.]) | |
154 | fi | |
dae5f5cf | 155 | |
cb7283db | 156 | if test "$srv_cv_tls_get_addr" = yes; then |
dae5f5cf DJ |
157 | AC_DEFINE(HAVE_TD_THR_TLS_GET_ADDR, 1, [Define if td_thr_tls_get_addr is available.]) |
158 | fi | |
0d62e5e8 DJ |
159 | fi |
160 | ||
fb1e4ffc DJ |
161 | if test "$srv_xmltarget" != ""; then |
162 | srv_xmltarget="\$(XML_DIR)/$srv_xmltarget" | |
163 | srv_xmlbuiltin="xml-builtin.o" | |
164 | AC_DEFINE(USE_XML, 1, [Define if an XML target description is available.]) | |
165 | ||
166 | tmp_xmlfiles=$srv_xmlfiles | |
167 | srv_xmlfiles="target.xml" | |
168 | for f in $tmp_xmlfiles; do | |
169 | srv_xmlfiles="$srv_xmlfiles \$(XML_DIR)/$f" | |
170 | done | |
171 | fi | |
172 | ||
0d62e5e8 DJ |
173 | GDBSERVER_DEPFILES="$srv_regobj $srv_tgtobj $srv_thread_depfiles" |
174 | GDBSERVER_LIBS="$srv_libs" | |
c906108c | 175 | |
7ea81414 | 176 | AC_SUBST(GDBSERVER_DEPFILES) |
0d62e5e8 DJ |
177 | AC_SUBST(GDBSERVER_LIBS) |
178 | AC_SUBST(USE_THREAD_DB) | |
fb1e4ffc DJ |
179 | AC_SUBST(srv_xmlbuiltin) |
180 | AC_SUBST(srv_xmlfiles) | |
181 | AC_SUBST(srv_xmltarget) | |
c906108c | 182 | |
c3a3ccc7 DJ |
183 | AC_OUTPUT(Makefile, |
184 | [case x$CONFIG_HEADERS in | |
185 | xconfig.h:config.in) | |
186 | echo > stamp-h ;; | |
187 | esac | |
188 | ]) |