Commit | Line | Data |
---|---|---|
d6e9fb05 | 1 | dnl Autoconf configure script for GDB server. |
f6de3c42 | 2 | dnl Copyright 2000, 2002, 2003, 2004 Free Software Foundation, Inc. |
d6e9fb05 JK |
3 | dnl |
4 | dnl This file is part of GDB. | |
5 | dnl | |
6 | dnl This program is free software; you can redistribute it and/or modify | |
7 | dnl it under the terms of the GNU General Public License as published by | |
8 | dnl the Free Software Foundation; either version 2 of the License, or | |
9 | dnl (at your option) any later version. | |
10 | dnl | |
11 | dnl This program is distributed in the hope that it will be useful, | |
12 | dnl but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | dnl GNU General Public License for more details. | |
15 | dnl | |
16 | dnl You should have received a copy of the GNU General Public License | |
17 | dnl along with this program; if not, write to the Free Software | |
18 | dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
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 | |
ee6e2b82 | 33 | AC_HEADER_STDC |
84563040 | 34 | |
0d62e5e8 | 35 | AC_CHECK_HEADERS(sgtty.h termio.h termios.h sys/reg.h string.h dnl |
94e10508 DJ |
36 | proc_service.h sys/procfs.h thread_db.h linux/elf.h dnl |
37 | stdlib.h unistd.h) | |
84563040 | 38 | |
43d5792c DJ |
39 | BFD_NEED_DECLARATION(strerror) |
40 | ||
7ea81414 | 41 | . ${srcdir}/configure.srv |
c906108c | 42 | |
58caa3dc DJ |
43 | if test "${srv_linux_usrregs}" = "yes"; then |
44 | AC_DEFINE(HAVE_LINUX_USRREGS) | |
45 | fi | |
46 | ||
47 | if test "${srv_linux_regsets}" = "yes"; then | |
48 | AC_MSG_CHECKING(for PTRACE_GETREGS) | |
49 | AC_CACHE_VAL(gdbsrv_cv_have_ptrace_getregs, | |
50 | [AC_TRY_COMPILE([#include <sys/ptrace.h>], | |
51 | [PTRACE_GETREGS;], | |
52 | [gdbsrv_cv_have_ptrace_getregs=yes], | |
53 | [gdbsrv_cv_have_ptrace_getregs=no])]) | |
54 | AC_MSG_RESULT($gdbsrv_cv_have_ptrace_getregs) | |
55 | if test "${gdbsrv_cv_have_ptrace_getregs}" = "yes"; then | |
56 | AC_DEFINE(HAVE_LINUX_REGSETS) | |
57 | fi | |
58 | ||
59 | AC_MSG_CHECKING(for PTRACE_GETFPXREGS) | |
60 | AC_CACHE_VAL(gdbsrv_cv_have_ptrace_getfpxregs, | |
61 | [AC_TRY_COMPILE([#include <sys/ptrace.h>], | |
62 | [PTRACE_GETFPXREGS;], | |
63 | [gdbsrv_cv_have_ptrace_getfpxregs=yes], | |
64 | [gdbsrv_cv_have_ptrace_getfpxregs=no])]) | |
65 | AC_MSG_RESULT($gdbsrv_cv_have_ptrace_getfpxregs) | |
66 | if test "${gdbsrv_cv_have_ptrace_getfpxregs}" = "yes"; then | |
67 | AC_DEFINE(HAVE_PTRACE_GETFPXREGS) | |
68 | fi | |
69 | fi | |
70 | ||
0d62e5e8 DJ |
71 | if test "$ac_cv_header_sys_procfs_h" = yes; then |
72 | BFD_HAVE_SYS_PROCFS_TYPE(lwpid_t) | |
73 | BFD_HAVE_SYS_PROCFS_TYPE(psaddr_t) | |
74 | BFD_HAVE_SYS_PROCFS_TYPE(prgregset_t) | |
75 | BFD_HAVE_SYS_PROCFS_TYPE(prfpregset_t) | |
76 | ||
77 | dnl Check for broken prfpregset_t type | |
78 | ||
79 | dnl For Linux/i386, glibc 2.1.3 was released with a bogus | |
80 | dnl prfpregset_t type (it's a typedef for the pointer to a struct | |
81 | dnl instead of the struct itself). We detect this here, and work | |
82 | dnl around it in gdb_proc_service.h. | |
83 | ||
84 | if test $bfd_cv_have_sys_procfs_type_prfpregset_t = yes; then | |
85 | AC_MSG_CHECKING(whether prfpregset_t type is broken) | |
86 | AC_CACHE_VAL(gdb_cv_prfpregset_t_broken, | |
87 | [AC_TRY_RUN([#include <sys/procfs.h> | |
88 | int main () | |
89 | { | |
90 | if (sizeof (prfpregset_t) == sizeof (void *)) | |
91 | return 1; | |
92 | return 0; | |
93 | }], | |
94 | gdb_cv_prfpregset_t_broken=no, | |
95 | gdb_cv_prfpregset_t_broken=yes, | |
96 | gdb_cv_prfpregset_t_broken=yes)]) | |
97 | AC_MSG_RESULT($gdb_cv_prfpregset_t_broken) | |
98 | if test $gdb_cv_prfpregset_t_broken = yes; then | |
99 | AC_DEFINE(PRFPREGSET_T_BROKEN) | |
100 | fi | |
101 | fi | |
102 | ||
103 | BFD_HAVE_SYS_PROCFS_TYPE(elf_fpregset_t) | |
104 | fi | |
105 | ||
106 | srv_thread_depfiles= | |
107 | srv_libs= | |
108 | USE_THREAD_DB= | |
109 | ||
110 | if test "$srv_linux_thread_db" = "yes"; then | |
111 | SRV_CHECK_THREAD_DB | |
112 | if test "$srv_cv_thread_db" = no; then | |
113 | AC_WARN([Could not find libthread_db.]) | |
114 | AC_WARN([Disabling thread support in gdbserver.]) | |
115 | srv_linux_thread_db=no | |
116 | else | |
117 | srv_libs="$srv_cv_thread_db" | |
118 | fi | |
f6de3c42 DJ |
119 | old_LDFLAGS="$LDFLAGS" |
120 | LDFLAGS="$LDFLAGS -rdynamic" | |
121 | AC_TRY_LINK([], [], [RDYNAMIC=-rdynamic], [RDYNAMIC=]) | |
122 | AC_SUBST(RDYNAMIC) | |
123 | LDFLAGS="$old_LDFLAGS" | |
0d62e5e8 DJ |
124 | fi |
125 | ||
126 | if test "$srv_linux_thread_db" = "yes"; then | |
127 | srv_thread_depfiles="thread-db.o proc-service.o" | |
128 | USE_THREAD_DB="-DUSE_THREAD_DB" | |
129 | fi | |
130 | ||
131 | GDBSERVER_DEPFILES="$srv_regobj $srv_tgtobj $srv_thread_depfiles" | |
132 | GDBSERVER_LIBS="$srv_libs" | |
c906108c | 133 | |
7ea81414 | 134 | AC_SUBST(GDBSERVER_DEPFILES) |
0d62e5e8 DJ |
135 | AC_SUBST(GDBSERVER_LIBS) |
136 | AC_SUBST(USE_THREAD_DB) | |
c906108c | 137 | |
c3a3ccc7 DJ |
138 | AC_OUTPUT(Makefile, |
139 | [case x$CONFIG_HEADERS in | |
140 | xconfig.h:config.in) | |
141 | echo > stamp-h ;; | |
142 | esac | |
143 | ]) |