Commit | Line | Data |
---|---|---|
d6e9fb05 | 1 | dnl Autoconf configure script for GDB server. |
e28b3332 | 2 | dnl Copyright (C) 2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008 |
0050a760 | 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 | 25 | AC_CONFIG_HEADER(config.h:config.in) |
e28b3332 | 26 | AC_CONFIG_LIBOBJ_DIR(../gnulib) |
84563040 DJ |
27 | |
28 | AC_PROG_CC | |
fd462a61 | 29 | AC_GNU_SOURCE |
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) |
4e799345 | 45 | AC_CHECK_FUNCS(pread pwrite pread64) |
e28b3332 | 46 | AC_REPLACE_FUNCS(memmem) |
84563040 | 47 | |
68070c10 PA |
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 | ||
ec56be1b | 64 | AC_CHECK_DECLS([strerror, perror, memmem]) |
43d5792c | 65 | |
ccbd4912 MK |
66 | AC_CHECK_TYPES(socklen_t, [], [], |
67 | [#include <sys/types.h> | |
68 | #include <sys/socket.h> | |
69 | ]) | |
fb1e4ffc | 70 | |
c16158bc JM |
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 | ||
7ea81414 | 76 | . ${srcdir}/configure.srv |
c906108c | 77 | |
68070c10 PA |
78 | if test "${srv_mingwce}" = "yes"; then |
79 | LIBS="$LIBS -lws2" | |
80 | elif test "${srv_mingw}" = "yes"; then | |
b80864fb | 81 | LIBS="$LIBS -lwsock32" |
68070c10 PA |
82 | fi |
83 | ||
84 | if test "${srv_mingw}" = "yes"; then | |
b80864fb DJ |
85 | AC_DEFINE(USE_WIN32API, 1, |
86 | [Define if we should use the Windows API, instead of the | |
87 | POSIX API. On Windows, we use the Windows API when | |
88 | building for MinGW, but the POSIX API when building | |
89 | for Cygwin.]) | |
90 | fi | |
91 | ||
58caa3dc | 92 | if test "${srv_linux_usrregs}" = "yes"; then |
f450004a DJ |
93 | AC_DEFINE(HAVE_LINUX_USRREGS, 1, |
94 | [Define if the target supports PTRACE_PEEKUSR for register ] | |
95 | [access.]) | |
58caa3dc DJ |
96 | fi |
97 | ||
98 | if test "${srv_linux_regsets}" = "yes"; then | |
e9d25b98 DJ |
99 | AC_DEFINE(HAVE_LINUX_REGSETS, 1, |
100 | [Define if the target supports register sets.]) | |
101 | ||
58caa3dc DJ |
102 | AC_MSG_CHECKING(for PTRACE_GETREGS) |
103 | AC_CACHE_VAL(gdbsrv_cv_have_ptrace_getregs, | |
104 | [AC_TRY_COMPILE([#include <sys/ptrace.h>], | |
105 | [PTRACE_GETREGS;], | |
106 | [gdbsrv_cv_have_ptrace_getregs=yes], | |
107 | [gdbsrv_cv_have_ptrace_getregs=no])]) | |
108 | AC_MSG_RESULT($gdbsrv_cv_have_ptrace_getregs) | |
109 | if test "${gdbsrv_cv_have_ptrace_getregs}" = "yes"; then | |
e9d25b98 | 110 | AC_DEFINE(HAVE_PTRACE_GETREGS, 1, |
f450004a DJ |
111 | [Define if the target supports PTRACE_GETREGS for register ] |
112 | [access.]) | |
58caa3dc DJ |
113 | fi |
114 | ||
115 | AC_MSG_CHECKING(for PTRACE_GETFPXREGS) | |
116 | AC_CACHE_VAL(gdbsrv_cv_have_ptrace_getfpxregs, | |
117 | [AC_TRY_COMPILE([#include <sys/ptrace.h>], | |
118 | [PTRACE_GETFPXREGS;], | |
119 | [gdbsrv_cv_have_ptrace_getfpxregs=yes], | |
120 | [gdbsrv_cv_have_ptrace_getfpxregs=no])]) | |
121 | AC_MSG_RESULT($gdbsrv_cv_have_ptrace_getfpxregs) | |
122 | if test "${gdbsrv_cv_have_ptrace_getfpxregs}" = "yes"; then | |
f450004a DJ |
123 | AC_DEFINE(HAVE_PTRACE_GETFPXREGS, 1, |
124 | [Define if the target supports PTRACE_GETFPXREGS for extended ] | |
125 | [register access.]) | |
58caa3dc DJ |
126 | fi |
127 | fi | |
128 | ||
0d62e5e8 DJ |
129 | if test "$ac_cv_header_sys_procfs_h" = yes; then |
130 | BFD_HAVE_SYS_PROCFS_TYPE(lwpid_t) | |
131 | BFD_HAVE_SYS_PROCFS_TYPE(psaddr_t) | |
132 | BFD_HAVE_SYS_PROCFS_TYPE(prgregset_t) | |
0d62e5e8 DJ |
133 | BFD_HAVE_SYS_PROCFS_TYPE(elf_fpregset_t) |
134 | fi | |
135 | ||
136 | srv_thread_depfiles= | |
137 | srv_libs= | |
138 | USE_THREAD_DB= | |
139 | ||
140 | if test "$srv_linux_thread_db" = "yes"; then | |
141 | SRV_CHECK_THREAD_DB | |
142 | if test "$srv_cv_thread_db" = no; then | |
143 | AC_WARN([Could not find libthread_db.]) | |
144 | AC_WARN([Disabling thread support in gdbserver.]) | |
145 | srv_linux_thread_db=no | |
146 | else | |
147 | srv_libs="$srv_cv_thread_db" | |
dae5f5cf | 148 | SRV_CHECK_TLS_GET_ADDR |
0d62e5e8 | 149 | fi |
f6de3c42 DJ |
150 | old_LDFLAGS="$LDFLAGS" |
151 | LDFLAGS="$LDFLAGS -rdynamic" | |
152 | AC_TRY_LINK([], [], [RDYNAMIC=-rdynamic], [RDYNAMIC=]) | |
153 | AC_SUBST(RDYNAMIC) | |
154 | LDFLAGS="$old_LDFLAGS" | |
0d62e5e8 DJ |
155 | fi |
156 | ||
157 | if test "$srv_linux_thread_db" = "yes"; then | |
158 | srv_thread_depfiles="thread-db.o proc-service.o" | |
159 | USE_THREAD_DB="-DUSE_THREAD_DB" | |
3db0444b DJ |
160 | AC_CACHE_CHECK([for TD_VERSION], gdbsrv_cv_have_td_version, |
161 | [AC_TRY_COMPILE([#include <thread_db.h>], [TD_VERSION;], | |
162 | [gdbsrv_cv_have_td_version=yes], | |
163 | [gdbsrv_cv_have_td_version=no])]) | |
164 | if test $gdbsrv_cv_have_td_version = yes; then | |
165 | AC_DEFINE(HAVE_TD_VERSION, 1, [Define if TD_VERSION is available.]) | |
166 | fi | |
dae5f5cf | 167 | |
cb7283db | 168 | if test "$srv_cv_tls_get_addr" = yes; then |
dae5f5cf DJ |
169 | AC_DEFINE(HAVE_TD_THR_TLS_GET_ADDR, 1, [Define if td_thr_tls_get_addr is available.]) |
170 | fi | |
0d62e5e8 DJ |
171 | fi |
172 | ||
9b4b61c8 | 173 | if test "$srv_xmlfiles" != ""; then |
fb1e4ffc DJ |
174 | srv_xmlbuiltin="xml-builtin.o" |
175 | AC_DEFINE(USE_XML, 1, [Define if an XML target description is available.]) | |
176 | ||
177 | tmp_xmlfiles=$srv_xmlfiles | |
9b4b61c8 | 178 | srv_xmlfiles="" |
fb1e4ffc DJ |
179 | for f in $tmp_xmlfiles; do |
180 | srv_xmlfiles="$srv_xmlfiles \$(XML_DIR)/$f" | |
181 | done | |
182 | fi | |
183 | ||
59a016f0 | 184 | GDBSERVER_DEPFILES="$srv_regobj $srv_tgtobj $srv_hostio_err_objs $srv_thread_depfiles" |
0d62e5e8 | 185 | GDBSERVER_LIBS="$srv_libs" |
c906108c | 186 | |
7ea81414 | 187 | AC_SUBST(GDBSERVER_DEPFILES) |
0d62e5e8 DJ |
188 | AC_SUBST(GDBSERVER_LIBS) |
189 | AC_SUBST(USE_THREAD_DB) | |
fb1e4ffc DJ |
190 | AC_SUBST(srv_xmlbuiltin) |
191 | AC_SUBST(srv_xmlfiles) | |
c906108c | 192 | |
c3a3ccc7 DJ |
193 | AC_OUTPUT(Makefile, |
194 | [case x$CONFIG_HEADERS in | |
195 | xconfig.h:config.in) | |
196 | echo > stamp-h ;; | |
197 | esac | |
198 | ]) |