* configure.ac (i[34567]86-*): Check if we're targetting x86-64
[deliverable/binutils-gdb.git] / gdb / gdbserver / configure.ac
... / ...
CommitLineData
1dnl Autoconf configure script for GDB server.
2dnl Copyright (C) 2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008
3dnl Free Software Foundation, Inc.
4dnl
5dnl This file is part of GDB.
6dnl
7dnl This program is free software; you can redistribute it and/or modify
8dnl it under the terms of the GNU General Public License as published by
9dnl the Free Software Foundation; either version 3 of the License, or
10dnl (at your option) any later version.
11dnl
12dnl This program is distributed in the hope that it will be useful,
13dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
14dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15dnl GNU General Public License for more details.
16dnl
17dnl You should have received a copy of the GNU General Public License
18dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
19
20dnl Process this file with autoconf to produce a configure script.
21
22AC_PREREQ(2.59)dnl
23
24AC_INIT(server.c)
25AC_CONFIG_HEADER(config.h:config.in)
26AC_CONFIG_LIBOBJ_DIR(../gnulib)
27
28AC_PROG_CC
29AC_GNU_SOURCE
30
31AC_CANONICAL_SYSTEM
32
33AC_PROG_INSTALL
34
35AC_ARG_PROGRAM
36
37AC_HEADER_STDC
38
39AC_CHECK_HEADERS(sgtty.h termio.h termios.h sys/reg.h string.h dnl
40 proc_service.h sys/procfs.h thread_db.h linux/elf.h dnl
41 stdlib.h unistd.h dnl
42 errno.h fcntl.h signal.h sys/file.h malloc.h dnl
43 sys/ioctl.h netinet/in.h sys/socket.h netdb.h dnl
44 netinet/tcp.h arpa/inet.h sys/wait.h)
45AC_CHECK_FUNCS(pread pwrite pread64)
46AC_REPLACE_FUNCS(memmem)
47
48have_errno=no
49AC_MSG_CHECKING(for errno)
50AC_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])
55if test $have_errno = no; then
56AC_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)])
62fi
63
64AC_CHECK_DECLS([strerror, perror, memmem])
65
66AC_CHECK_TYPES(socklen_t, [], [],
67[#include <sys/types.h>
68#include <sys/socket.h>
69])
70
71ACX_PKGVERSION([GDB])
72ACX_BUGURL([http://www.gnu.org/software/gdb/bugs/])
73AC_DEFINE_UNQUOTED([PKGVERSION], ["$PKGVERSION"], [Additional package description])
74AC_DEFINE_UNQUOTED([REPORT_BUGS_TO], ["$REPORT_BUGS_TO"], [Bug reporting address])
75
76# Check for various supplementary target information (beyond the
77# triplet) which might affect the choices in configure.srv.
78case "${target}" in
79changequote(,)dnl
80 i[34567]86-*-linux*)
81changequote([,])dnl
82 AC_CACHE_CHECK([if building for x86-64], [gdb_cv_i386_is_x86_64],
83 [save_CPPFLAGS="$CPPFLAGS"
84 CPPFLAGS="$CPPFLAGS $CFLAGS"
85 AC_EGREP_CPP([got it], [
86#if __x86_64__
87got it
88#endif
89 ], [gdb_cv_i386_is_x86_64=yes],
90 [gdb_cv_i386_is_x86_64=no])
91 CPPFLAGS="$save_CPPFLAGS"])
92 ;;
93esac
94
95. ${srcdir}/configure.srv
96
97if test "${srv_mingwce}" = "yes"; then
98 LIBS="$LIBS -lws2"
99elif test "${srv_mingw}" = "yes"; then
100 LIBS="$LIBS -lwsock32"
101elif test "${srv_qnx}" = "yes"; then
102 LIBS="$LIBS -lsocket"
103fi
104
105if test "${srv_mingw}" = "yes"; then
106 AC_DEFINE(USE_WIN32API, 1,
107 [Define if we should use the Windows API, instead of the
108 POSIX API. On Windows, we use the Windows API when
109 building for MinGW, but the POSIX API when building
110 for Cygwin.])
111fi
112
113if test "${srv_linux_usrregs}" = "yes"; then
114 AC_DEFINE(HAVE_LINUX_USRREGS, 1,
115 [Define if the target supports PTRACE_PEEKUSR for register ]
116 [access.])
117fi
118
119if test "${srv_linux_regsets}" = "yes"; then
120 AC_DEFINE(HAVE_LINUX_REGSETS, 1,
121 [Define if the target supports register sets.])
122
123 AC_MSG_CHECKING(for PTRACE_GETREGS)
124 AC_CACHE_VAL(gdbsrv_cv_have_ptrace_getregs,
125 [AC_TRY_COMPILE([#include <sys/ptrace.h>],
126 [PTRACE_GETREGS;],
127 [gdbsrv_cv_have_ptrace_getregs=yes],
128 [gdbsrv_cv_have_ptrace_getregs=no])])
129 AC_MSG_RESULT($gdbsrv_cv_have_ptrace_getregs)
130 if test "${gdbsrv_cv_have_ptrace_getregs}" = "yes"; then
131 AC_DEFINE(HAVE_PTRACE_GETREGS, 1,
132 [Define if the target supports PTRACE_GETREGS for register ]
133 [access.])
134 fi
135
136 AC_MSG_CHECKING(for PTRACE_GETFPXREGS)
137 AC_CACHE_VAL(gdbsrv_cv_have_ptrace_getfpxregs,
138 [AC_TRY_COMPILE([#include <sys/ptrace.h>],
139 [PTRACE_GETFPXREGS;],
140 [gdbsrv_cv_have_ptrace_getfpxregs=yes],
141 [gdbsrv_cv_have_ptrace_getfpxregs=no])])
142 AC_MSG_RESULT($gdbsrv_cv_have_ptrace_getfpxregs)
143 if test "${gdbsrv_cv_have_ptrace_getfpxregs}" = "yes"; then
144 AC_DEFINE(HAVE_PTRACE_GETFPXREGS, 1,
145 [Define if the target supports PTRACE_GETFPXREGS for extended ]
146 [register access.])
147 fi
148fi
149
150if test "$ac_cv_header_sys_procfs_h" = yes; then
151 BFD_HAVE_SYS_PROCFS_TYPE(lwpid_t)
152 BFD_HAVE_SYS_PROCFS_TYPE(psaddr_t)
153 BFD_HAVE_SYS_PROCFS_TYPE(prgregset_t)
154 BFD_HAVE_SYS_PROCFS_TYPE(elf_fpregset_t)
155fi
156
157srv_thread_depfiles=
158srv_libs=
159USE_THREAD_DB=
160
161if test "$srv_linux_thread_db" = "yes"; then
162 srv_libs="-ldl"
163 old_LDFLAGS="$LDFLAGS"
164 LDFLAGS="$LDFLAGS -rdynamic"
165 AC_TRY_LINK([], [], [RDYNAMIC=-rdynamic], [RDYNAMIC=])
166 AC_SUBST(RDYNAMIC)
167 LDFLAGS="$old_LDFLAGS"
168
169 srv_thread_depfiles="thread-db.o proc-service.o"
170 USE_THREAD_DB="-DUSE_THREAD_DB"
171 AC_CACHE_CHECK([for TD_VERSION], gdbsrv_cv_have_td_version,
172 [AC_TRY_COMPILE([#include <thread_db.h>], [TD_VERSION;],
173 [gdbsrv_cv_have_td_version=yes],
174 [gdbsrv_cv_have_td_version=no])])
175 if test $gdbsrv_cv_have_td_version = yes; then
176 AC_DEFINE(HAVE_TD_VERSION, 1, [Define if TD_VERSION is available.])
177 fi
178fi
179
180AC_ARG_WITH(libthread-db,
181AS_HELP_STRING([--with-libthread-db=PATH], [use given libthread_db directly]),
182[srv_libthread_db_path="${withval}"
183 AC_DEFINE(USE_LIBTHREAD_DB_DIRECTLY, 1, [Define if we should use libthread_db directly.])
184 srv_libs="$srv_libthread_db_path"
185])
186
187if test "$srv_xmlfiles" != ""; then
188 srv_xmlbuiltin="xml-builtin.o"
189 AC_DEFINE(USE_XML, 1, [Define if an XML target description is available.])
190
191 tmp_xmlfiles=$srv_xmlfiles
192 srv_xmlfiles=""
193 for f in $tmp_xmlfiles; do
194 srv_xmlfiles="$srv_xmlfiles \$(XML_DIR)/$f"
195 done
196fi
197
198GDBSERVER_DEPFILES="$srv_regobj $srv_tgtobj $srv_hostio_err_objs $srv_thread_depfiles"
199GDBSERVER_LIBS="$srv_libs"
200
201AC_SUBST(GDBSERVER_DEPFILES)
202AC_SUBST(GDBSERVER_LIBS)
203AC_SUBST(USE_THREAD_DB)
204AC_SUBST(srv_xmlbuiltin)
205AC_SUBST(srv_xmlfiles)
206
207AC_OUTPUT(Makefile,
208[case x$CONFIG_HEADERS in
209xconfig.h:config.in)
210echo > stamp-h ;;
211esac
212])
This page took 0.023242 seconds and 4 git commands to generate.